2%
require-or-eval.js
/**
* requireOrEval
* =============
*
* Модуль, помогающий поддерживать переходные (с `eval` на `require`) BEM-форматы.
*
* Например, раньше `bemjson` выглядел так:
* ```javascript
* ({
* block: 'button'
* })
* ```
*
* Новый вариант `bemjson` выглядит так:
* ```javascript
* module.exports = {
* block: 'button'
* };
* ```
*/
var asyncRequire = require('./async-require');
var vowFs = require('./async-fs');
var vm = require('vm');
var dropRequireCache = require('./drop-require-cache');
/**
* @name requireOrEval
* @returns {Promise}
*/
Function (anonymous_1)
✗ Was not called
module.exports = function (filePath) {···
// Replace slashes with backslashes for windows paths for correct require cache work.
var isWinPath = /^\w{1}:/.test(filePath);
filePath = isWinPath ? filePath.replace(/\//g, '\\') : filePath;

dropRequireCache(require, filePath);
return asyncRequire(filePath).then(function (json) {
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
var hasData = false;
for (var i in json) {
if (json.hasOwnProperty(i)) {
hasData = true;
break;
}
}
if (hasData) {
return json;
} else {
return vowFs.read(filePath, 'utf8').then(function (data) {
return vm.runInThisContext(data);
});
}
} else {
// Если был возвращен не объект, либо null, значит значение явно экспортировалось.
return json;
}
});
};
module.exports = function (filePath) {
// Replace slashes with backslashes for windows paths for correct require cache work.
var isWinPath = /^\w{1}:/.test(filePath);
Branch ConditionalExpression
✗ Positive was not returned (? ...)
filePath = isWinPath ? filePath.replace(/\//g, '\\') : filePath;
✗ Negative was not returned (: ...)
filePath = isWinPath ? filePath.replace(/\//g, '\\') : filePath;
filePath = isWinPath ? filePath.replace(/\//g, '\\') : filePath;
dropRequireCache(require, filePath);
Function (anonymous_2)
✗ Was not called
return asyncRequire(filePath).then(function (json) {···
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
var hasData = false;
for (var i in json) {
if (json.hasOwnProperty(i)) {
hasData = true;
break;
}
}
if (hasData) {
return json;
} else {
return vowFs.read(filePath, 'utf8').then(function (data) {
return vm.runInThisContext(data);
});
}
} else {
// Если был возвращен не объект, либо null, значит значение явно экспортировалось.
return json;
}
});
return asyncRequire(filePath).then(function (json) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {···
var hasData = false;
for (var i in json) {
if (json.hasOwnProperty(i)) {
hasData = true;
break;
}
}
if (hasData) {
return json;
} else {
return vowFs.read(filePath, 'utf8').then(function (data) {
return vm.runInThisContext(data);
});
}
} else {
✗ Negative was not executed (else)
} else {···
// Если был возвращен не объект, либо null, значит значение явно экспортировалось.
return json;
}
Branch LogicalExpression
✗ Was not returned
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
✗ Was not returned
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
Branch LogicalExpression
✗ Was not returned
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
✗ Was not returned
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
if (typeof json === 'object' && json !== null && !Array.isArray(json)) {
var hasData = false;
for (var i in json) {
Branch IfStatement
✗ Positive was not executed (if)
if (json.hasOwnProperty(i)) {···
hasData = true;
break;
}
✗ Negative was not executed (else)
}···
}
if (json.hasOwnProperty(i)) {
hasData = true;
break;
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (hasData) {···
return json;
} else {
✗ Negative was not executed (else)
} else {···
return vowFs.read(filePath, 'utf8').then(function (data) {
return vm.runInThisContext(data);
});
}
if (hasData) {
return json;
} else {
Function (anonymous_3)
✗ Was not called
return vowFs.read(filePath, 'utf8').then(function (data) {···
return vm.runInThisContext(data);
});
return vowFs.read(filePath, 'utf8').then(function (data) {
return vm.runInThisContext(data);
});
}
} else {
// Если был возвращен не объект, либо null, значит значение явно экспортировалось.
return json;
}
});
};
async-require.js
/**
* async-require
* =============
*
* Асинхронный require. Работает через промис.
*/
var Vow = require('vow');
var delay = 1;
Function (anonymous_4)
✗ Was not called
module.exports = function (filename) {···
var promise = Vow.promise();
var doRequire = function () {
try {
var result = require(filename);
promise.fulfill(result);
delay = Math.max(1, delay / 2);
} catch (e) {
if (e.code === 'EMFILE') {
delay++;
setTimeout(doRequire, delay);
} else {
promise.reject(e);
}
}
};
doRequire();
return promise;
};
module.exports = function (filename) {
var promise = Vow.promise();
Function (anonymous_5)
✗ Was not called
var doRequire = function () {···
try {
var result = require(filename);
promise.fulfill(result);
delay = Math.max(1, delay / 2);
} catch (e) {
if (e.code === 'EMFILE') {
delay++;
setTimeout(doRequire, delay);
} else {
promise.reject(e);
}
}
};
var doRequire = function () {
try {
var result = require(filename);
promise.fulfill(result);
delay = Math.max(1, delay / 2);
} catch (e) {
Branch IfStatement
✗ Positive was not executed (if)
if (e.code === 'EMFILE') {···
delay++;
setTimeout(doRequire, delay);
} else {
✗ Negative was not executed (else)
} else {···
promise.reject(e);
}
if (e.code === 'EMFILE') {
delay++;
setTimeout(doRequire, delay);
} else {
promise.reject(e);
}
}
};
doRequire();
return promise;
};
async-fs.js
var vowFs = require('vow-fs');
Branch IfStatement
✗ Positive was not executed (if)
if (process.env.ENB_FILE_LIMIT) {···
vowFs.options({
openFileLimit: parseInt(process.env.ENB_FILE_LIMIT, 10)
});
}
✓ Negative was executed (else)
}···

module.exports = vowFs;
if (process.env.ENB_FILE_LIMIT) {
vowFs.options({
openFileLimit: parseInt(process.env.ENB_FILE_LIMIT, 10)
});
}
module.exports = vowFs;
drop-require-cache.js
Function (anonymous_6)
✗ Was not called
module.exports = function (requireFunc, filename) {···
var module = requireFunc.cache[filename];
if (module) {
if (module.parent) {
if (module.parent.children) {
var moduleIndex = module.parent.children.indexOf(module);
if (moduleIndex !== -1) {
module.parent.children.splice(moduleIndex, 1);
}
}
delete module.parent;
}
delete module.children;
delete requireFunc.cache[filename];
}
};
module.exports = function (requireFunc, filename) {
var module = requireFunc.cache[filename];
Branch IfStatement
✗ Positive was not executed (if)
if (module) {···
if (module.parent) {
if (module.parent.children) {
var moduleIndex = module.parent.children.indexOf(module);
if (moduleIndex !== -1) {
module.parent.children.splice(moduleIndex, 1);
}
}
delete module.parent;
}
delete module.children;
delete requireFunc.cache[filename];
}
✗ Negative was not executed (else)
}···
};
if (module) {
Branch IfStatement
✗ Positive was not executed (if)
if (module.parent) {···
if (module.parent.children) {
var moduleIndex = module.parent.children.indexOf(module);
if (moduleIndex !== -1) {
module.parent.children.splice(moduleIndex, 1);
}
}
delete module.parent;
}
✗ Negative was not executed (else)
}···
delete module.children;
if (module.parent) {
Branch IfStatement
✗ Positive was not executed (if)
if (module.parent.children) {···
var moduleIndex = module.parent.children.indexOf(module);
if (moduleIndex !== -1) {
module.parent.children.splice(moduleIndex, 1);
}
}
✗ Negative was not executed (else)
}···
delete module.parent;
if (module.parent.children) {
var moduleIndex = module.parent.children.indexOf(module);
Branch IfStatement
✗ Positive was not executed (if)
if (moduleIndex !== -1) {···
module.parent.children.splice(moduleIndex, 1);
}
✗ Negative was not executed (else)
}···
}
if (moduleIndex !== -1) {
module.parent.children.splice(moduleIndex, 1);
}
}
delete module.parent;
}
delete module.children;
delete requireFunc.cache[filename];
}
};
build-flow.js
/**
* BuildFlow
* =========
*/
var inherit = require('inherit');
var Vow = require('vow');
var vowFs = require('./fs/async-fs');
/**
* BuildFlow — это хэлпер для упрощения создания полностью настраиваемых технологий.
*
* Например, сборка js:
* ```javascript
* module.exports = require('enb/lib/build-flow').create()
* .name('js')
* .target('target', '?.js')
* .useFileList('js')
* .justJoinFilesWithComments()
* .createTech();
* ```
* @name BuildFlow
*/
var BuildFlow = inherit( /** @lends BuildFlow.prototype */ {
/**
* Конструктор.
*/
__constructor: function () {
this._name = '';
this._usages = [];
this._dependencies = [];
this._targetOptionName = '';
this._defaultTargetName = '';
this._requiredOptions = [];
this._options = {};
this._methods = {};
this._staticMethods = {};
this._deprecationNotice = null;
this._optionAliases = {};
Function (anonymous_8)
✗ Was not called
this._prepareFunc = function () {};
this._prepareFunc = function () {};
Function (anonymous_9)
✗ Was not called
this._buildFunc = function () {···
throw new Error('You should declare build function using "build" method of BuildFlow.');
};
this._buildFunc = function () {
throw new Error('You should declare build function using "build" method of BuildFlow.');
};
Function (anonymous_10)
✗ Was not called
this._wrapFunc = function (data) {···
return data;
};
this._wrapFunc = function (data) {
return data;
};
Function (anonymous_11)
✗ Was not called
this._saveFunc = function (filename, result) {···
return vowFs.write(filename, result, 'utf8');
};
this._saveFunc = function (filename, result) {
return vowFs.write(filename, result, 'utf8');
};
Function (anonymous_12)
✗ Was not called
this._cacheValidator = function () {···
return false;
};
this._cacheValidator = function () {
return false;
};
Function (anonymous_13)
✗ Was not called
this._cacheSaver = function () {};
this._cacheSaver = function () {};
},
/**
* Устанавливает имя технологии.
* @param {String} techName
* @returns {BuildFlow}
*/
name: function (techName) {
return this._copyAnd(function (buildFlow) {
buildFlow._name = techName;
});
},
/**
* @param {String} thisPackage
* @param {String} [newPackage]
* @param {String} [newTech]
* @param {String} [desc]
*/
deprecated: function (thisPackage, newPackage, newTech, desc) {
return this._copyAnd(function (buildFlow) {
buildFlow._deprecationNotice = {
thisPackage: thisPackage,
newPackage: newPackage,
newTech: newTech,
desc: desc
};
});
},
/**
* Определяет опцию для технологии.
* @param {String} optionName Имя опции.
* @param {*} [defaultValue] Значение по умолчанию.
* @param {String} [fieldName] Имя поля, в которое необходимо записать значение опции
* (по умолчанию — "_<имя опции>").
* @returns {BuildFlow}
*/
defineOption: function (optionName, defaultValue, fieldName) {
return this._copyAnd(function (buildFlow) {
buildFlow._options[optionName] = {
Branch LogicalExpression
✓ Was returned
fieldName: fieldName || '_' + optionName,
✓ Was returned
fieldName: fieldName || '_' + optionName,
fieldName: fieldName || '_' + optionName,
defaultValue: defaultValue
};
});
},
/**
* Определяет обязательную опцию для технологии.
* @param {String} optionName Имя опции.
* @param {String} [fieldName] Имя поля, в которое необходимо записать значение опции
* (по умолчанию — "_<имя опции>").
* @returns {BuildFlow}
*/
defineRequiredOption: function (optionName, fieldName) {
return this._copyAnd(function (buildFlow) {
buildFlow._options[optionName] = {
Branch LogicalExpression
✓ Was returned
fieldName: fieldName || '_' + optionName
✗ Was not returned
fieldName: fieldName || '_' + optionName
fieldName: fieldName || '_' + optionName
};
buildFlow._requiredOptions.push(optionName);
});
},
/**
* Объявляет алиас для опции.
*
* @param {String} optionName
* @param {String} aliasName
*/
Function (anonymous_22)
✗ Was not called
optionAlias: function (optionName, aliasName) {···
return this._copyAnd(function (buildFlow) {
buildFlow._optionAliases[aliasName] = optionName;
});
},
optionAlias: function (optionName, aliasName) {
Function (anonymous_23)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._optionAliases[aliasName] = optionName;
});
return this._copyAnd(function (buildFlow) {
buildFlow._optionAliases[aliasName] = optionName;
});
},
/**
* Требует список файлов по суффиксу или суффиксам.
* Например, .useFileList("js") добавит в аргументы билдеру список файлов с расширением js.
* Значение по умолчанию можно переопределить параметром sourceSuffixes
* @param {String|Array} defaultSuffixes Значение по умолчанию.
* @returns {BuildFlow}
*/
useFileList: function (defaultSuffixes) {
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(
new BuildFlowLinkToFileList('filesTarget', '?.files', defaultSuffixes)
);
});
},
/**
* Требует список директорий по суффиксу или суффиксам.
* Например, .useDirList("i18n") добавит в аргументы билдеру список директорий с расширением i18n.
* @param {String|Array} suffixes
* @returns {BuildFlow}
*/
useDirList: function (suffixes) {
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(
new BuildFlowLinkToDirList('dirsTarget', '?.dirs', suffixes)
);
});
},
/**
* Отменяет требование целей другой ноды.
* @param {String} name
* @returns {BuildFlow}
*/
Function (anonymous_28)
✗ Was not called
unuseTarget: function (name) {···
return this._copyAnd(function (buildFlow) {
buildFlow._removeUsage(name);
});
},
unuseTarget: function (name) {
Function (anonymous_29)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._removeUsage(name);
});
return this._copyAnd(function (buildFlow) {
buildFlow._removeUsage(name);
});
},
/**
* Отменяет требование списка файлов.
* @returns {BuildFlow}
*/
unuseFileList: function () {
return this._copyAnd(function (buildFlow) {
buildFlow._removeUsage('filesTarget');
});
},
/**
* Отменяет требование списка директорий.
* @returns {BuildFlow}
*/
Function (anonymous_32)
✗ Was not called
unuseDirList: function () {···
return this._copyAnd(function (buildFlow) {
buildFlow._removeUsage('dirsTarget');
});
},
unuseDirList: function () {
Function (anonymous_33)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._removeUsage('dirsTarget');
});
return this._copyAnd(function (buildFlow) {
buildFlow._removeUsage('dirsTarget');
});
},
/**
* Требует имя файла другого таргета ноды, объявляет зависимость от этого таргета.
* В аргументы билдера придет абсолютный путь к файлу.
* @param {String} targetOptionName Имя опции для таргета.
* @param {String} defaultTargetName Значение по умолчанию.
* @returns {BuildFlow}
*/
useSourceFilename: function (targetOptionName, defaultTargetName) {
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(new BuildFlowLinkToTargetFilename(targetOptionName, defaultTargetName));
});
},
/**
* Требует список имен файлов других таргетов ноды, объявляет зависимость от этого таргета.
* В аргументы билдера придет абсолютный путь к файлу.
* @param {String} targetOptionName Имя опции для таргета.
* @param {String[]} [defaultTargetNames] Значение по умолчанию.
* @returns {BuildFlow}
*/
useSourceListFilenames: function (targetOptionName, defaultTargetNames) {
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(
new BuildFlowLinkToTargetList(targetOptionName, defaultTargetNames, BuildFlowLinkToTargetFilename)
);
});
},
/**
* Требует содержимое файла другого таргета ноды, объявляет зависимость от этого таргета.
* В аргументы билдера придет содержимое файла.
* @param {String} targetOptionName Имя опции для таргета.
* @param {String} defaultTargetName Значение по умолчанию.
* @returns {BuildFlow}
*/
useSourceText: function (targetOptionName, defaultTargetName) {
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(new BuildFlowLinkToTargetSource(targetOptionName, defaultTargetName));
});
},
/**
* Требует результат выполнения другого таргета ноды, объявляет зависимость от этого таргета.
* В аргументы билдера придет результат выполнения технологии.
* @param {String} targetOptionName
* @param {String} defaultTargetName
* @returns {BuildFlow}
*/
Function (anonymous_40)
✗ Was not called
useSourceResult: function (targetOptionName, defaultTargetName) {···
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(new BuildFlowLinkToTargetResult(targetOptionName, defaultTargetName));
});
},
useSourceResult: function (targetOptionName, defaultTargetName) {
Function (anonymous_41)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._addUsage(new BuildFlowLinkToTargetResult(targetOptionName, defaultTargetName));
});
return this._copyAnd(function (buildFlow) {
buildFlow._addUsage(new BuildFlowLinkToTargetResult(targetOptionName, defaultTargetName));
});
},
/**
* Объявляет зависимость от таргета ноды, но не добявляет аргументов в билдер.
* @param {String} targetOptionName
* @param {String} defaultTargetName
* @returns {BuildFlow}
*/
Function (anonymous_42)
✗ Was not called
dependOn: function (targetOptionName, defaultTargetName) {···
return this._copyAnd(function (buildFlow) {
buildFlow._addDep(new BuildFlowLinkToTargetNoResult(targetOptionName, defaultTargetName));
});
},
dependOn: function (targetOptionName, defaultTargetName) {
Function (anonymous_43)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._addDep(new BuildFlowLinkToTargetNoResult(targetOptionName, defaultTargetName));
});
return this._copyAnd(function (buildFlow) {
buildFlow._addDep(new BuildFlowLinkToTargetNoResult(targetOptionName, defaultTargetName));
});
},
/**
* Настраивает таргет для технологии.
* @param {String} targetOptionName Имя опции, в котором передается таргет.
* @param {String} defaultTargetName Имя таргета по умолчанию.
* @returns {BuildFlow}
*/
target: function (targetOptionName, defaultTargetName) {
return this._copyAnd(function (buildFlow) {
buildFlow._targetOptionName = targetOptionName;
buildFlow._defaultTargetName = defaultTargetName;
});
},
/**
* Определяет метод для сборки. Метод должен возвращать строку-результат сборки, либо промис,
* который резолвится строкой.
* Основной метод для технологии. Все источники, которые были определены через методы use* будут переданы в билдер,
* как аргументы.
* @param {Function} func
* @returns {BuildFlow}
*/
builder: function (func) {
return this._copyAnd(function (buildFlow) {
buildFlow._buildFunc = func;
});
},
/**
* Определяет метод подготовки к сборке. Метод не принимает никаких аргументов.
*
* @param {Function} func
* @returns {BuildFlow}
*/
Function (anonymous_48)
✗ Was not called
prepare: function (func) {···
return this._copyAnd(function (buildFlow) {
buildFlow._prepareFunc = func;
});
},
prepare: function (func) {
Function (anonymous_49)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._prepareFunc = func;
});
return this._copyAnd(function (buildFlow) {
buildFlow._prepareFunc = func;
});
},
/**
* Определяет метод проверки кэша при сборке.
* Метод должен возвращает булевое значение.
* true — необходимо пересобрать таргет.
* false — нет необходимости пересобирать таргет.
* @param {Function} func
* @returns {BuildFlow}
*/
Function (anonymous_50)
✗ Was not called
needRebuild: function (func) {···
return this._copyAnd(function (buildFlow) {
buildFlow._cacheValidator = func;
});
},
needRebuild: function (func) {
Function (anonymous_51)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._cacheValidator = func;
});
return this._copyAnd(function (buildFlow) {
buildFlow._cacheValidator = func;
});
},
/**
* Сохраняет кэш для того, чтобы избежать лишнюю повторную сборку.
* @param {Function} func
* @returns {BuildFlow}
*/
Function (anonymous_52)
✗ Was not called
saveCache: function (func) {···
return this._copyAnd(function (buildFlow) {
buildFlow._cacheSaver = func;
});
},
saveCache: function (func) {
Function (anonymous_53)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._cacheSaver = func;
});
return this._copyAnd(function (buildFlow) {
buildFlow._cacheSaver = func;
});
},
/**
* Определяет функцию-враппер.
* В функцию передает строка, которую возвращает билдер.
* @param {Function} func
* @returns {BuildFlow}
*/
Function (anonymous_54)
✗ Was not called
wrapper: function (func) {···
return this._copyAnd(function (buildFlow) {
buildFlow._wrapFunc = func;
});
},
wrapper: function (func) {
Function (anonymous_55)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._wrapFunc = func;
});
return this._copyAnd(function (buildFlow) {
buildFlow._wrapFunc = func;
});
},
/**
* Определяет функцию, сохраняющую результат выполнения билдера.
* Фунция должна возвратить промис.
* @param {Function} func
* @returns {BuildFlow}
*/
Function (anonymous_56)
✗ Was not called
saver: function (func) {···
return this._copyAnd(function (buildFlow) {
buildFlow._saveFunc = func;
});
},
saver: function (func) {
Function (anonymous_57)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._saveFunc = func;
});
return this._copyAnd(function (buildFlow) {
buildFlow._saveFunc = func;
});
},
/**
* Определяет набор методов технологии.
* @param {Object} methods Методы в виде хэш-таблицы (объекта).
* @returns {BuildFlow}
*/
methods: function (methods) {
return this._copyAnd(function (buildFlow) {
Object.keys(methods).forEach(function (methodName) {
buildFlow._methods[methodName] = methods[methodName];
});
});
},
/**
* Определяет набор статических методов технологии.
* @param {Object} staticMethods Методы в виде хэш-таблицы (объекта).
* @returns {BuildFlow}
*/
staticMethods: function (staticMethods) {
return this._copyAnd(function (buildFlow) {
Object.keys(staticMethods).forEach(function (methodName) {
buildFlow._staticMethods[methodName] = staticMethods[methodName];
});
});
},
/**
* Создает копию инстанции BuildFlow.
* @returns {BuildFlow}
*/
copy: function () {
var result = new BuildFlow();
result._targetOptionName = this._targetOptionName;
result._defaultTargetName = this._defaultTargetName;
result._name = this._name;
result._usages = this._usages.slice(0);
result._dependencies = this._dependencies.slice(0);
result._requiredOptions = this._requiredOptions.slice(0);
result._buildFunc = this._buildFunc;
result._saveFunc = this._saveFunc;
result._wrapFunc = this._wrapFunc;
result._cacheValidator = this._cacheValidator;
result._cacheSaver = this._cacheSaver;
result._prepareFunc = this._prepareFunc;
result._deprecationNotice = this._deprecationNotice;
var options = this._options;
Object.keys(options).forEach(function (optName) {
result._options[optName] = options[optName];
});
var methods = this._methods;
Object.keys(methods).forEach(function (methodName) {
result._methods[methodName] = methods[methodName];
});
var staticMethods = this._staticMethods;
Object.keys(staticMethods).forEach(function (methodName) {
result._staticMethods[methodName] = staticMethods[methodName];
});
var optionAliases = this._optionAliases;
Function (anonymous_68)
✗ Was not called
Object.keys(optionAliases).forEach(function (optionName) {···
result._optionAliases[optionName] = optionAliases[optionName];
});
Object.keys(optionAliases).forEach(function (optionName) {
result._optionAliases[optionName] = optionAliases[optionName];
});
return result;
},
/**
* Хэлпер для построения билдера, который просто объединяет файлы, переданные в аргументах.
* @param wrapper
* @returns {BuildFlow}
*/
justJoinFiles: function (wrapper) {
return this._copyAnd(function (buildFlow) {
Function (anonymous_71)
✗ Was not called
buildFlow._buildFunc = function () {···
var _this = this;
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
if (typeof arg === 'string') {
return vowFs.read(arg, 'utf8').then(function (data) {
return wrapper ? wrapper.call(_this, arg, data) : data;
});
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg, wrapper);
} else {
return '';
}
})).then(function (res) {
return res.join('\n');
});
};
buildFlow._buildFunc = function () {
var _this = this;
Function (anonymous_72)
✗ Was not called
return Vow.all(Array.prototype.map.call(arguments, function (arg) {···
if (typeof arg === 'string') {
return vowFs.read(arg, 'utf8').then(function (data) {
return wrapper ? wrapper.call(_this, arg, data) : data;
});
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg, wrapper);
} else {
return '';
}
})).then(function (res) {
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof arg === 'string') {···
return vowFs.read(arg, 'utf8').then(function (data) {
return wrapper ? wrapper.call(_this, arg, data) : data;
});
} else if (Array.isArray(arg)) {
✗ Negative was not executed (else)
} else if (Array.isArray(arg)) {···
return _this._joinFiles(arg, wrapper);
} else {
return '';
}
if (typeof arg === 'string') {
Function (anonymous_73)
✗ Was not called
return vowFs.read(arg, 'utf8').then(function (data) {···
return wrapper ? wrapper.call(_this, arg, data) : data;
});
return vowFs.read(arg, 'utf8').then(function (data) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return wrapper ? wrapper.call(_this, arg, data) : data;
✗ Negative was not returned (: ...)
return wrapper ? wrapper.call(_this, arg, data) : data;
return wrapper ? wrapper.call(_this, arg, data) : data;
});
Branch IfStatement
✗ Positive was not executed (if)
} else if (Array.isArray(arg)) {···
return _this._joinFiles(arg, wrapper);
} else {
✗ Negative was not executed (else)
} else {···
return '';
}
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg, wrapper);
} else {
return '';
}
Function (anonymous_74)
✗ Was not called
})).then(function (res) {···
return res.join('\n');
});
})).then(function (res) {
return res.join('\n');
});
};
});
},
/**
* Хэлпер для построения билдера, который объединяет файлы, переданные в аргументах, расставляя комментарии
* о расположении файлов.
* @returns {BuildFlow}
*/
justJoinFilesWithComments: function () {
Function (anonymous_76)
✗ Was not called
return this.justJoinFiles(function (filename, data) {···
var fn = this.node.relativePath(filename);
return '/* begin: ' + fn + ' *' + '/\n' + data + '\n/* end: ' + fn + ' *' + '/';
});
return this.justJoinFiles(function (filename, data) {
var fn = this.node.relativePath(filename);
return '/* begin: ' + fn + ' *' + '/\n' + data + '\n/* end: ' + fn + ' *' + '/';
});
},
/**
* Хэлпер для построения билдера, который объединяет текст, переданный в аргументах.
* @returns {BuildFlow}
*/
Function (anonymous_77)
✗ Was not called
justJoinSources: function () {···
return this._copyAnd(function (buildFlow) {
buildFlow._buildFunc = function () {
var _this = this;
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
if (typeof arg === 'string') {
return arg;
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg);
} else {
return '';
}
})).then(function (res) {
return res.join('\n');
});
};
});
},
justJoinSources: function () {
Function (anonymous_78)
✗ Was not called
return this._copyAnd(function (buildFlow) {···
buildFlow._buildFunc = function () {
var _this = this;
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
if (typeof arg === 'string') {
return arg;
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg);
} else {
return '';
}
})).then(function (res) {
return res.join('\n');
});
};
});
return this._copyAnd(function (buildFlow) {
Function (anonymous_79)
✗ Was not called
buildFlow._buildFunc = function () {···
var _this = this;
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
if (typeof arg === 'string') {
return arg;
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg);
} else {
return '';
}
})).then(function (res) {
return res.join('\n');
});
};
buildFlow._buildFunc = function () {
var _this = this;
Function (anonymous_80)
✗ Was not called
return Vow.all(Array.prototype.map.call(arguments, function (arg) {···
if (typeof arg === 'string') {
return arg;
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg);
} else {
return '';
}
})).then(function (res) {
return Vow.all(Array.prototype.map.call(arguments, function (arg) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof arg === 'string') {···
return arg;
} else if (Array.isArray(arg)) {
✗ Negative was not executed (else)
} else if (Array.isArray(arg)) {···
return _this._joinFiles(arg);
} else {
return '';
}
if (typeof arg === 'string') {
return arg;
Branch IfStatement
✗ Positive was not executed (if)
} else if (Array.isArray(arg)) {···
return _this._joinFiles(arg);
} else {
✗ Negative was not executed (else)
} else {···
return '';
}
} else if (Array.isArray(arg)) {
return _this._joinFiles(arg);
} else {
return '';
}
Function (anonymous_81)
✗ Was not called
})).then(function (res) {···
return res.join('\n');
});
})).then(function (res) {
return res.join('\n');
});
};
});
},
_addUsage: function (usage) {
return this._addToTargetLinks(this._usages, usage);
},
_removeUsage: function (targetOptionName) {
this._usages = this._usages.filter(function (link) {
return link.getTargetOptionName() !== targetOptionName;
});
},
Function (anonymous_85)
✗ Was not called
_addDep: function (dep) {···
return this._addToTargetLinks(this._dependencies, dep);
},
_addDep: function (dep) {
return this._addToTargetLinks(this._dependencies, dep);
},
_addToTargetLinks: function (links, link) {
var optionName = link.getTargetOptionName();
for (var i = 0, l = links.length; i < l; i++) {
Branch IfStatement
✓ Positive was executed (if)
if (links[i].getTargetOptionName() === optionName) {···
links[i] = link;
return this;
}
✓ Negative was executed (else)
}···
}
if (links[i].getTargetOptionName() === optionName) {
links[i] = link;
return this;
}
}
links.push(link);
return this;
},
/**
* Создает копию BuildFlow и выполняет переданную функцию для копии.
* Возвращает копию.
* @param {Function} func
* @returns {BuildFlow}
* @private
*/
_copyAnd: function (func) {
var result = this.copy();
func(result);
return result;
},
/**
* Создает технологию.
* @returns {Tech}
*/
createTech: function () {
var name = this._name;
var targetOptionName = this._targetOptionName;
var defaultTargetName = this._defaultTargetName;
var usages = this._usages.concat(this._dependencies);
var requiredOptions = this._requiredOptions;
var options = this._options;
var buildFunc = this._buildFunc;
var saveFunc = this._saveFunc;
var wrapFunc = this._wrapFunc;
var cacheValidator = this._cacheValidator;
var cacheSaver = this._cacheSaver;
var preparer = this._prepareFunc;
var methods = this._methods;
var staticMethods = this._staticMethods;
var deprecationNotice = this._deprecationNotice;
var optionAliases = this._optionAliases;
Branch IfStatement
✗ Positive was not executed (if)
if (!name) {···
throw new Error('You should declare tech name using "name" method of BuildFlow.');
}
✓ Negative was executed (else)
}···
if (!targetOptionName) {
if (!name) {
throw new Error('You should declare tech name using "name" method of BuildFlow.');
}
Branch IfStatement
✗ Positive was not executed (if)
if (!targetOptionName) {···
throw new Error('You should declare tech target name using "target" method of BuildFlow.');
}
✓ Negative was executed (else)
}···
var resultTechMethods = {
if (!targetOptionName) {
throw new Error('You should declare tech target name using "target" method of BuildFlow.');
}
var resultTechMethods = {
Function (anonymous_89)
✗ Was not called
configure: function () {···
var _this = this;
var node = this.node;
Object.keys(optionAliases).forEach(function (aliasName) {
if (this._options.hasOwnProperty(aliasName)) {
var optionName = optionAliases[aliasName];
this._options[optionName] = this._options[aliasName];
delete this._options[aliasName];
}
}, this);
this._optionFieldNames = {};
Object.keys(options).forEach(function (optName) {
var option = options[optName];
_this[option.fieldName] = _this.getOption(optName, option.defaultValue);
_this._optionFieldNames[optName] = option.fieldName;
});
this._target = node.unmaskTargetName(
this._preprocessTargetName(_this.getOption(targetOptionName, defaultTargetName))
);
requiredOptions.forEach(function (requiredOption) {
_this.getRequiredOption(requiredOption);
});
usages.forEach(function (usage) {
usage.configureUsages(_this, node);
});
this._buildResult = undefined;
},
configure: function () {
var _this = this;
var node = this.node;
Function (anonymous_90)
✗ Was not called
Object.keys(optionAliases).forEach(function (aliasName) {···
if (this._options.hasOwnProperty(aliasName)) {
var optionName = optionAliases[aliasName];
this._options[optionName] = this._options[aliasName];
delete this._options[aliasName];
}
}, this);
Object.keys(optionAliases).forEach(function (aliasName) {
Branch IfStatement
✗ Positive was not executed (if)
if (this._options.hasOwnProperty(aliasName)) {···
var optionName = optionAliases[aliasName];
this._options[optionName] = this._options[aliasName];
delete this._options[aliasName];
}
✗ Negative was not executed (else)
}···
}, this);
if (this._options.hasOwnProperty(aliasName)) {
var optionName = optionAliases[aliasName];
this._options[optionName] = this._options[aliasName];
delete this._options[aliasName];
}
}, this);
this._optionFieldNames = {};
Function (anonymous_91)
✗ Was not called
Object.keys(options).forEach(function (optName) {···
var option = options[optName];
_this[option.fieldName] = _this.getOption(optName, option.defaultValue);
_this._optionFieldNames[optName] = option.fieldName;
});
Object.keys(options).forEach(function (optName) {
var option = options[optName];
_this[option.fieldName] = _this.getOption(optName, option.defaultValue);
_this._optionFieldNames[optName] = option.fieldName;
});
this._target = node.unmaskTargetName(
this._preprocessTargetName(_this.getOption(targetOptionName, defaultTargetName))
);
Function (anonymous_92)
✗ Was not called
requiredOptions.forEach(function (requiredOption) {···
_this.getRequiredOption(requiredOption);
});
requiredOptions.forEach(function (requiredOption) {
_this.getRequiredOption(requiredOption);
});
Function (anonymous_93)
✗ Was not called
usages.forEach(function (usage) {···
usage.configureUsages(_this, node);
});
usages.forEach(function (usage) {
usage.configureUsages(_this, node);
});
this._buildResult = undefined;
},
Function (anonymous_94)
✗ Was not called
getName: function () {···
return name;
},
getName: function () {
return name;
},
Function (anonymous_95)
✗ Was not called
getTargets: function () {···
return [this._target];
},
getTargets: function () {
return [this._target];
},
Function (anonymous_96)
✗ Was not called
_requireSources: function () {···
var _this = this;
var node = this.node;
return Vow.all(usages.map(function (usage) {
return usage.requireTarget(_this, node);
}));
},
_requireSources: function () {
var _this = this;
var node = this.node;
Function (anonymous_97)
✗ Was not called
return Vow.all(usages.map(function (usage) {···
return usage.requireTarget(_this, node);
}));
return Vow.all(usages.map(function (usage) {
return usage.requireTarget(_this, node);
}));
},
Function (anonymous_98)
✗ Was not called
_isRebuildRequired: function () {···
var cache = this.node.getNodeCache(this._target);
if (cacheValidator.call(this, cache)) {
return true;
}
if (cache.needRebuildFile('target', this.node.resolvePath(this._target))) {
return true;
}
for (var i = 0, l = usages.length; i < l; i++) {
if (!usages[i].isCacheValid(this, this.node, cache)) {
return true;
}
}
return false;
},
_isRebuildRequired: function () {
var cache = this.node.getNodeCache(this._target);
Branch IfStatement
✗ Positive was not executed (if)
if (cacheValidator.call(this, cache)) {···
return true;
}
✗ Negative was not executed (else)
}···
if (cache.needRebuildFile('target', this.node.resolvePath(this._target))) {
if (cacheValidator.call(this, cache)) {
return true;
}
Branch IfStatement
✗ Positive was not executed (if)
if (cache.needRebuildFile('target', this.node.resolvePath(this._target))) {···
return true;
}
✗ Negative was not executed (else)
}···
for (var i = 0, l = usages.length; i < l; i++) {
if (cache.needRebuildFile('target', this.node.resolvePath(this._target))) {
return true;
}
for (var i = 0, l = usages.length; i < l; i++) {
Branch IfStatement
✗ Positive was not executed (if)
if (!usages[i].isCacheValid(this, this.node, cache)) {···
return true;
}
✗ Negative was not executed (else)
}···
}
if (!usages[i].isCacheValid(this, this.node, cache)) {
return true;
}
}
return false;
},
Function (anonymous_99)
✗ Was not called
_saveCache: function () {···
var cache = this.node.getNodeCache(this._target);
cache.cacheFileInfo('target', this.node.resolvePath(this._target));
for (var i = 0, l = usages.length; i < l; i++) {
usages[i].saveCache(this, this.node, cache);
}
cacheSaver.call(this, cache);
},
_saveCache: function () {
var cache = this.node.getNodeCache(this._target);
cache.cacheFileInfo('target', this.node.resolvePath(this._target));
for (var i = 0, l = usages.length; i < l; i++) {
usages[i].saveCache(this, this.node, cache);
}
cacheSaver.call(this, cache);
},
Function (anonymous_100)
✗ Was not called
_getBuildResult: function () {···
return buildFunc.apply(this, arguments);
},
_getBuildResult: function () {
return buildFunc.apply(this, arguments);
},
Function (anonymous_101)
✗ Was not called
_saveBuildResult: function () {···
return saveFunc.apply(this, arguments);
},
_saveBuildResult: function () {
return saveFunc.apply(this, arguments);
},
Function (anonymous_102)
✗ Was not called
_wrapBuildResult: function () {···
return wrapFunc.apply(this, arguments);
},
_wrapBuildResult: function () {
return wrapFunc.apply(this, arguments);
},
Function (anonymous_103)
✗ Was not called
_joinFiles: function (files, wrapper) {···
var _this = this;
return Vow.all(files.map(function (fileInfo) {
return vowFs.read(fileInfo.fullname, 'utf8').then(function (data) {
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
});
})).then(function (results) {
return results.join('\n');
});
},
_joinFiles: function (files, wrapper) {
var _this = this;
Function (anonymous_104)
✗ Was not called
return Vow.all(files.map(function (fileInfo) {···
return vowFs.read(fileInfo.fullname, 'utf8').then(function (data) {
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
});
})).then(function (results) {
return Vow.all(files.map(function (fileInfo) {
Function (anonymous_105)
✗ Was not called
return vowFs.read(fileInfo.fullname, 'utf8').then(function (data) {···
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
});
return vowFs.read(fileInfo.fullname, 'utf8').then(function (data) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
✗ Negative was not returned (: ...)
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
return wrapper ? wrapper.call(_this, fileInfo.fullname, data) : data;
});
Function (anonymous_106)
✗ Was not called
})).then(function (results) {···
return results.join('\n');
});
})).then(function (results) {
return results.join('\n');
});
},
Function (anonymous_107)
✗ Was not called
_joinFilesWithComments: function (files) {···
var node = this.node;
return this._joinFiles(files, function (filename, data) {
var fn = node.relativePath(filename);
return '/* begin: ' + fn + ' *' + '/\n' + data + '\n/* end: ' + fn + ' *' + '/';
});
},
_joinFilesWithComments: function (files) {
var node = this.node;
Function (anonymous_108)
✗ Was not called
return this._joinFiles(files, function (filename, data) {···
var fn = node.relativePath(filename);
return '/* begin: ' + fn + ' *' + '/\n' + data + '\n/* end: ' + fn + ' *' + '/';
});
return this._joinFiles(files, function (filename, data) {
var fn = node.relativePath(filename);
return '/* begin: ' + fn + ' *' + '/\n' + data + '\n/* end: ' + fn + ' *' + '/';
});
},
Function (anonymous_109)
✗ Was not called
_preprocessTargetName: function (targetName) {···
var _this = this;
return targetName.replace(/{([^}]+)}/g, function (s, optName) {
if (_this._optionFieldNames[optName]) {
return _this[_this._optionFieldNames[optName]] || '';
} else {
return _this.getOption(optName, '');
}
});
},
_preprocessTargetName: function (targetName) {
var _this = this;
Function (anonymous_110)
✗ Was not called
return targetName.replace(/{([^}]+)}/g, function (s, optName) {···
if (_this._optionFieldNames[optName]) {
return _this[_this._optionFieldNames[optName]] || '';
} else {
return _this.getOption(optName, '');
}
});
return targetName.replace(/{([^}]+)}/g, function (s, optName) {
Branch IfStatement
✗ Positive was not executed (if)
if (_this._optionFieldNames[optName]) {···
return _this[_this._optionFieldNames[optName]] || '';
} else {
✗ Negative was not executed (else)
} else {···
return _this.getOption(optName, '');
}
if (_this._optionFieldNames[optName]) {
Branch LogicalExpression
✗ Was not returned
return _this[_this._optionFieldNames[optName]] || '';
✗ Was not returned
return _this[_this._optionFieldNames[optName]] || '';
return _this[_this._optionFieldNames[optName]] || '';
} else {
return _this.getOption(optName, '');
}
});
},
Function (anonymous_111)
✗ Was not called
setResult: function (value) {···
this._buildResult = value;
},
setResult: function (value) {
this._buildResult = value;
},
Function (anonymous_112)
✗ Was not called
_prepare: function () {···
return preparer.call(this);
},
_prepare: function () {
return preparer.call(this);
},
Function (anonymous_113)
✗ Was not called
build: function () {···
var _this = this;
var node = this.node;
return Vow.when(_this._prepare()).then(function () {
if (deprecationNotice) {
node.getLogger().logTechIsDeprecated(
_this._target,
name,
deprecationNotice.thisPackage,
deprecationNotice.newTech ||
(deprecationNotice.newPackage ? name : ''),
deprecationNotice.newPackage,
deprecationNotice.desc
);
}
return _this._requireSources().then(function (results) {
if (_this._isRebuildRequired()) {
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
} else {
node.isValidTarget(_this._target);
node.resolveTarget(_this._target, _this._buildResult);
return null;
}
});
});
}
build: function () {
var _this = this;
var node = this.node;
Function (anonymous_114)
✗ Was not called
return Vow.when(_this._prepare()).then(function () {···
if (deprecationNotice) {
node.getLogger().logTechIsDeprecated(
_this._target,
name,
deprecationNotice.thisPackage,
deprecationNotice.newTech ||
(deprecationNotice.newPackage ? name : ''),
deprecationNotice.newPackage,
deprecationNotice.desc
);
}
return _this._requireSources().then(function (results) {
if (_this._isRebuildRequired()) {
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
} else {
node.isValidTarget(_this._target);
node.resolveTarget(_this._target, _this._buildResult);
return null;
}
});
});
return Vow.when(_this._prepare()).then(function () {
Branch IfStatement
✗ Positive was not executed (if)
if (deprecationNotice) {···
node.getLogger().logTechIsDeprecated(
_this._target,
name,
deprecationNotice.thisPackage,
deprecationNotice.newTech ||
(deprecationNotice.newPackage ? name : ''),
deprecationNotice.newPackage,
deprecationNotice.desc
);
}
✗ Negative was not executed (else)
}···
return _this._requireSources().then(function (results) {
if (deprecationNotice) {
node.getLogger().logTechIsDeprecated(
_this._target,
name,
deprecationNotice.thisPackage,
Branch LogicalExpression
✗ Was not returned
(deprecationNotice.newPackage ? name : ''),
✗ Was not returned
deprecationNotice.newTech ||
deprecationNotice.newTech ||
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(deprecationNotice.newPackage ? name : ''),
✗ Negative was not returned (: ...)
(deprecationNotice.newPackage ? name : ''),
(deprecationNotice.newPackage ? name : ''),
deprecationNotice.newPackage,
deprecationNotice.desc
);
}
Function (anonymous_115)
✗ Was not called
return _this._requireSources().then(function (results) {···
if (_this._isRebuildRequired()) {
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
} else {
node.isValidTarget(_this._target);
node.resolveTarget(_this._target, _this._buildResult);
return null;
}
});
return _this._requireSources().then(function (results) {
Branch IfStatement
✗ Positive was not executed (if)
if (_this._isRebuildRequired()) {···
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
} else {
✗ Negative was not executed (else)
} else {···
node.isValidTarget(_this._target);
node.resolveTarget(_this._target, _this._buildResult);
return null;
}
if (_this._isRebuildRequired()) {
Function (anonymous_116)
✗ Was not called
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {···
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
return Vow.when(_this._getBuildResult.apply(_this, results)).then(function (data) {
Function (anonymous_117)
✗ Was not called
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {···
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
return Vow.when(_this._wrapBuildResult(data)).then(function (wrappedData) {
return Vow.when(
_this._saveBuildResult(_this.node.resolvePath(_this._target), wrappedData)
Function (anonymous_118)
✗ Was not called
).then(function () {···
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
).then(function () {
_this._saveCache();
node.resolveTarget(_this._target, _this._buildResult);
});
});
});
} else {
node.isValidTarget(_this._target);
node.resolveTarget(_this._target, _this._buildResult);
return null;
}
});
});
}
};
Object.keys(methods).forEach(function (methodName) {
resultTechMethods[methodName] = methods[methodName];
});
/**
* Результирующая технология, которая строится на основе инстанции BuildFlow.
*/
var resultTech = inherit(require('./tech/base-tech'), resultTechMethods, staticMethods);
var currentBuildFlow = this;
/**
* Каждому классу технологий добавляем метод buildFlow, чтобы вернуть инстанцию BuildFlow, с помощью которой
* была построена технология.
* @returns {BuildFlow}
*/
resultTech.buildFlow = function () {
return currentBuildFlow;
};
return resultTech;
}
});
/**
* Связь технологии с результатом выполнения другой цели.
*/
var BuildFlowLinkToTargetResult = inherit({
/**
* @param {String} targetOptionName
* @param {String} defaultTargetName
*/
__constructor: function (targetOptionName, defaultTargetName) {
this._targetOptionName = targetOptionName;
this._defaultTargetName = defaultTargetName;
this._fieldName = '_' + targetOptionName;
},
/**
* Возвращает имя опции для данной связи.
*
* @returns {String}
*/
getTargetOptionName: function () {
return this._targetOptionName;
},
/**
* Сохраняет размаскированное имя цели в поле в инстанции технологии.
*
* @param {Tech} tech
* @param {Node} node
*/
Function (anonymous_123)
✗ Was not called
configureUsages: function (tech, node) {···
tech[this._fieldName] = node.unmaskTargetName(
tech._preprocessTargetName(tech.getOption(this._targetOptionName, this._defaultTargetName))
);
},
configureUsages: function (tech, node) {
tech[this._fieldName] = node.unmaskTargetName(
tech._preprocessTargetName(tech.getOption(this._targetOptionName, this._defaultTargetName))
);
},
/**
* Проверяет валидность кэша.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
* @returns {Boolean}
*/
Function (anonymous_124)
✗ Was not called
isCacheValid: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
var targetPath = node.resolvePath(targetName);
return !cache.needRebuildFile('target:' + targetName, targetPath);
},
isCacheValid: function (tech, node, cache) {
var targetName = tech[this._fieldName];
var targetPath = node.resolvePath(targetName);
return !cache.needRebuildFile('target:' + targetName, targetPath);
},
/**
* Сохраняет в кэш информацию об использованных файлах.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
*/
Function (anonymous_125)
✗ Was not called
saveCache: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
var targetPath = node.resolvePath(targetName);
cache.cacheFileInfo('target:' + targetName, targetPath);
},
saveCache: function (tech, node, cache) {
var targetName = tech[this._fieldName];
var targetPath = node.resolvePath(targetName);
cache.cacheFileInfo('target:' + targetName, targetPath);
},
/**
* Требует у ноды выполнения необходимой цели.
* @param {Tech} tech
* @param {Node} node
* @returns {Promise}
*/
Function (anonymous_126)
✗ Was not called
requireTarget: function (tech, node) {···
var _this = this;
var processTargetResult = this._processTargetResult;
return node.requireSources([tech[this._fieldName]]).spread(function (result) {
return processTargetResult.call(_this, tech, node, result);
});
},
requireTarget: function (tech, node) {
var _this = this;
var processTargetResult = this._processTargetResult;
Function (anonymous_127)
✗ Was not called
return node.requireSources([tech[this._fieldName]]).spread(function (result) {···
return processTargetResult.call(_this, tech, node, result);
});
return node.requireSources([tech[this._fieldName]]).spread(function (result) {
return processTargetResult.call(_this, tech, node, result);
});
},
/**
* Возвращает имя поля, в которое связь пишет имя цели.
*
* @returns {String}
*/
Function (anonymous_128)
✗ Was not called
getFieldName: function () {···
return this._fieldName;
},
getFieldName: function () {
return this._fieldName;
},
Function (anonymous_129)
✗ Was not called
_processTargetResult: function (tech, node, result) {···
return result;
}
_processTargetResult: function (tech, node, result) {
return result;
}
});
/**
* Связь технологии с другой целью без получения результата.
*/
var BuildFlowLinkToTargetNoResult = inherit(BuildFlowLinkToTargetResult, {
Function (anonymous_130)
✗ Was not called
_processTargetResult: function () {···
return '';
}
_processTargetResult: function () {
return '';
}
});
/**
* Связь технологии с абсолютным путем к другой цели.
*/
var BuildFlowLinkToTargetFilename = inherit(BuildFlowLinkToTargetResult, {
Function (anonymous_131)
✗ Was not called
_processTargetResult: function (tech, node) {···
return node.resolvePath(tech[this._fieldName]);
}
_processTargetResult: function (tech, node) {
return node.resolvePath(tech[this._fieldName]);
}
});
/**
* Связь технологии с текстовым содержимым файла другой цели.
*/
var BuildFlowLinkToTargetSource = inherit(BuildFlowLinkToTargetResult, {
Function (anonymous_132)
✗ Was not called
_processTargetResult: function (tech, node) {···
return vowFs.read(node.resolvePath(tech[this._fieldName]), 'utf8');
}
_processTargetResult: function (tech, node) {
return vowFs.read(node.resolvePath(tech[this._fieldName]), 'utf8');
}
});
/**
* Связь технологии со списком файлов (префиксами).
*/
var BuildFlowLinkToFileList = inherit(BuildFlowLinkToTargetResult, {
/**
* @param {String} targetOptionName
* @param {String} defaultTargetName
* @param {String|Array} defaultSuffixes
*/
__constructor: function (targetOptionName, defaultTargetName, defaultSuffixes) {
this._targetOptionName = targetOptionName;
this._defaultTargetName = defaultTargetName;
this._fieldName = '_' + targetOptionName;
this._listName = '_list' + targetOptionName;
this._suffixesOptionName = 'sourceSuffixes';
this._defaultSuffixes = defaultSuffixes;
},
/**
* Возвращает имя опции для данной связи.
*
* @returns {String}
*/
getTargetOptionName: function () {
return this._targetOptionName;
},
/**
* Проверяет валидность кэша.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
* @returns {Boolean}
*/
Function (anonymous_135)
✗ Was not called
isCacheValid: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
return !cache.needRebuildFileList('target:' + targetName, tech[this._listName]);
},
isCacheValid: function (tech, node, cache) {
var targetName = tech[this._fieldName];
return !cache.needRebuildFileList('target:' + targetName, tech[this._listName]);
},
/**
* Сохраняет в кэш информацию об использованных файлах.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
*/
Function (anonymous_136)
✗ Was not called
saveCache: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
return cache.cacheFileList('target:' + targetName, tech[this._listName]);
},
saveCache: function (tech, node, cache) {
var targetName = tech[this._fieldName];
return cache.cacheFileList('target:' + targetName, tech[this._listName]);
},
Function (anonymous_137)
✗ Was not called
_processTargetResult: function (tech, node, result) {···
var suffixes = tech.getOption(this._suffixesOptionName) || this._defaultSuffixes;
suffixes = (Array.isArray(suffixes) ? suffixes : [suffixes]);
tech[this._listName] = result.getBySuffix(suffixes);
return tech[this._listName];
}
_processTargetResult: function (tech, node, result) {
Branch LogicalExpression
✗ Was not returned
var suffixes = tech.getOption(this._suffixesOptionName) || this._defaultSuffixes;
✗ Was not returned
var suffixes = tech.getOption(this._suffixesOptionName) || this._defaultSuffixes;
var suffixes = tech.getOption(this._suffixesOptionName) || this._defaultSuffixes;
Branch ConditionalExpression
✗ Positive was not returned (? ...)
suffixes = (Array.isArray(suffixes) ? suffixes : [suffixes]);
✗ Negative was not returned (: ...)
suffixes = (Array.isArray(suffixes) ? suffixes : [suffixes]);
suffixes = (Array.isArray(suffixes) ? suffixes : [suffixes]);
tech[this._listName] = result.getBySuffix(suffixes);
return tech[this._listName];
}
});
/**
* Связь технологии со списком директорий (префиксами).
*/
var BuildFlowLinkToDirList = inherit(BuildFlowLinkToTargetResult, {
/**
* @param {String} targetOptionName
* @param {String} defaultTargetName
* @param {String|Array} suffixes
*/
__constructor: function (targetOptionName, defaultTargetName, suffixes) {
this._targetOptionName = targetOptionName;
this._defaultTargetName = defaultTargetName;
this._fieldName = '_' + targetOptionName;
this._listName = '_list' + targetOptionName;
this._suffixesOptionName = 'sourceDirSuffixes';
this._suffixes = suffixes;
},
/**
* Возвращает имя опции для данной связи.
*
* @returns {String}
*/
getTargetOptionName: function () {
return this._targetOptionName;
},
/**
* Проверяет валидность кэша.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
* @returns {Boolean}
*/
Function (anonymous_140)
✗ Was not called
isCacheValid: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
var files = [].concat.apply([], tech[this._listName].map(function (dir) {
return dir.files;
}));
return !cache.needRebuildFileList('target:' + targetName, files);
},
isCacheValid: function (tech, node, cache) {
var targetName = tech[this._fieldName];
Function (anonymous_141)
✗ Was not called
var files = [].concat.apply([], tech[this._listName].map(function (dir) {···
return dir.files;
}));
var files = [].concat.apply([], tech[this._listName].map(function (dir) {
return dir.files;
}));
return !cache.needRebuildFileList('target:' + targetName, files);
},
/**
* Сохраняет в кэш информацию об использованных файлах.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
*/
Function (anonymous_142)
✗ Was not called
saveCache: function (tech, node, cache) {···
var targetName = tech[this._fieldName];
var files = [].concat.apply([], tech[this._listName].map(function (dir) {
return dir.files;
}));
return cache.cacheFileList('target:' + targetName, files);
},
saveCache: function (tech, node, cache) {
var targetName = tech[this._fieldName];
Function (anonymous_143)
✗ Was not called
var files = [].concat.apply([], tech[this._listName].map(function (dir) {···
return dir.files;
}));
var files = [].concat.apply([], tech[this._listName].map(function (dir) {
return dir.files;
}));
return cache.cacheFileList('target:' + targetName, files);
},
Function (anonymous_144)
✗ Was not called
_processTargetResult: function (tech, node, result) {···
var suffixes = tech.getOption(this._suffixesOptionName) || this._suffixes;
suffixes = Array.isArray(suffixes) ? suffixes : [suffixes];
tech[this._listName] = result.getBySuffix(suffixes);
return tech[this._listName];
}
_processTargetResult: function (tech, node, result) {
Branch LogicalExpression
✗ Was not returned
var suffixes = tech.getOption(this._suffixesOptionName) || this._suffixes;
✗ Was not returned
var suffixes = tech.getOption(this._suffixesOptionName) || this._suffixes;
var suffixes = tech.getOption(this._suffixesOptionName) || this._suffixes;
Branch ConditionalExpression
✗ Positive was not returned (? ...)
suffixes = Array.isArray(suffixes) ? suffixes : [suffixes];
✗ Negative was not returned (: ...)
suffixes = Array.isArray(suffixes) ? suffixes : [suffixes];
suffixes = Array.isArray(suffixes) ? suffixes : [suffixes];
tech[this._listName] = result.getBySuffix(suffixes);
return tech[this._listName];
}
});
/**
* Связь технологии со списком целей.
*/
var BuildFlowLinkToTargetList = inherit({
/**
* @param {String} targetOptionName
* @param {String[]} defaultTargetNames
* @param {Function} linkClass
*/
__constructor: function (targetOptionName, defaultTargetNames, linkClass) {
this._targetOptionName = targetOptionName;
Branch LogicalExpression
✓ Was returned
this._defaultTargetNames = defaultTargetNames || [];
✓ Was returned
this._defaultTargetNames = defaultTargetNames || [];
this._defaultTargetNames = defaultTargetNames || [];
this._linkClass = linkClass;
this._fieldName = '_' + targetOptionName;
this._usagesFieldName = '_usageList_' + targetOptionName;
},
/**
* Возвращает имя опции для данной связи.
*
* @returns {String}
*/
getTargetOptionName: function () {
return this._targetOptionName;
},
/**
* Сохраняет размаскированное имя цели в поле в инстанции технологии.
*
* @param {Tech} tech
* @param {Node} node
*/
Function (anonymous_147)
✗ Was not called
configureUsages: function (tech, node) {···
var _this = this;
var links = [];
var targetNames = [];
var targetOptionName = this._targetOptionName;
var i = 0;
tech.getOption(this._targetOptionName, this._defaultTargetNames).forEach(function (targetName) {
var link = new _this._linkClass(targetOptionName + '[' + i + ']', targetName);
link.configureUsages(tech, node);
targetNames.push(tech[link.getFieldName()]);
links.push(link);
i++;
});
tech[this._fieldName] = targetNames;
tech[this._usagesFieldName] = links;
},
configureUsages: function (tech, node) {
var _this = this;
var links = [];
var targetNames = [];
var targetOptionName = this._targetOptionName;
var i = 0;
Function (anonymous_148)
✗ Was not called
tech.getOption(this._targetOptionName, this._defaultTargetNames).forEach(function (targetName) {···
var link = new _this._linkClass(targetOptionName + '[' + i + ']', targetName);
link.configureUsages(tech, node);
targetNames.push(tech[link.getFieldName()]);
links.push(link);
i++;
});
tech.getOption(this._targetOptionName, this._defaultTargetNames).forEach(function (targetName) {
var link = new _this._linkClass(targetOptionName + '[' + i + ']', targetName);
link.configureUsages(tech, node);
targetNames.push(tech[link.getFieldName()]);
links.push(link);
i++;
});
tech[this._fieldName] = targetNames;
tech[this._usagesFieldName] = links;
},
/**
* Проверяет валидность кэша.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
* @returns {Boolean}
*/
Function (anonymous_149)
✗ Was not called
isCacheValid: function (tech, node, cache) {···
var links = tech[this._usagesFieldName];
for (var i = 0, l = links.length; i < l; i++) {
if (!links[i].isCacheValid(tech, node, cache)) {
return false;
}
}
return true;
},
isCacheValid: function (tech, node, cache) {
var links = tech[this._usagesFieldName];
for (var i = 0, l = links.length; i < l; i++) {
Branch IfStatement
✗ Positive was not executed (if)
if (!links[i].isCacheValid(tech, node, cache)) {···
return false;
}
✗ Negative was not executed (else)
}···
}
if (!links[i].isCacheValid(tech, node, cache)) {
return false;
}
}
return true;
},
/**
* Сохраняет в кэш информацию об использованных файлах.
*
* @param {Tech} tech
* @param {Node} node
* @param {Cache} cache
*/
Function (anonymous_150)
✗ Was not called
saveCache: function (tech, node, cache) {···
tech[this._usagesFieldName].forEach(function (link) {
link.saveCache(tech, node, cache);
});
},
saveCache: function (tech, node, cache) {
Function (anonymous_151)
✗ Was not called
tech[this._usagesFieldName].forEach(function (link) {···
link.saveCache(tech, node, cache);
});
tech[this._usagesFieldName].forEach(function (link) {
link.saveCache(tech, node, cache);
});
},
/**
* Требует у ноды выполнения необходимой цели.
* @param {Tech} tech
* @param {Node} node
* @returns {Promise}
*/
Function (anonymous_152)
✗ Was not called
requireTarget: function (tech, node) {···
return Vow.all(tech[this._usagesFieldName].map(function (link) {
return link.requireTarget(tech, node);
}));
}
requireTarget: function (tech, node) {
Function (anonymous_153)
✗ Was not called
return Vow.all(tech[this._usagesFieldName].map(function (link) {···
return link.requireTarget(tech, node);
}));
return Vow.all(tech[this._usagesFieldName].map(function (link) {
return link.requireTarget(tech, node);
}));
}
});
exports.create = function () {
return new BuildFlow();
};
base-tech.js
/**
* BaseTech
* ========
*/
var inherit = require('inherit');
var Vow = require('vow');
/**
* Базовая технология.
* Предлагает методы для работы с опциями.
* От нее наследоваться не обязательно.
* @name BaseTech
* @type {Tech}
*/
module.exports = inherit({
/**
* Конструктор.
* В конструктор передаются опции из enb-make.js.
* @param options
*/
Function (anonymous_155)
✗ Was not called
__constructor: function (options) {···
this._options = options || {};
},
__constructor: function (options) {
Branch LogicalExpression
✗ Was not returned
this._options = options || {};
✗ Was not returned
this._options = options || {};
this._options = options || {};
},
/**
* Инициализирует технологию.
* @param {Node} node
*/
Function (anonymous_156)
✗ Was not called
init: function (node) {···
this.node = node;
this.configure();
},
init: function (node) {
this.node = node;
this.configure();
},
/**
* Хэлпер для конфигурирования.
*/
Function (anonymous_157)
✗ Was not called
configure: function () {},
configure: function () {},
/**
* Возвращает значение опции.
* @param {String} key
* @param {Object} defaultValue
* @returns {Object}
*/
Function (anonymous_158)
✗ Was not called
getOption: function (key, defaultValue) {···
return this._options.hasOwnProperty(key) ? this._options[key] : defaultValue;
},
getOption: function (key, defaultValue) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return this._options.hasOwnProperty(key) ? this._options[key] : defaultValue;
✗ Negative was not returned (: ...)
return this._options.hasOwnProperty(key) ? this._options[key] : defaultValue;
return this._options.hasOwnProperty(key) ? this._options[key] : defaultValue;
},
/**
* Возвращает значение опции. Кидает ошибку, если опция не указана.
* @param {String} key
* @returns {Object}
*/
Function (anonymous_159)
✗ Was not called
getRequiredOption: function (key) {···
if (!this._options.hasOwnProperty(key)) {
throw Error('Option "' + key + '" is required for technology "' + this.getName() + '".');
}
return this._options[key];
},
getRequiredOption: function (key) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._options.hasOwnProperty(key)) {···
throw Error('Option "' + key + '" is required for technology "' + this.getName() + '".');
}
✗ Negative was not executed (else)
}···
return this._options[key];
if (!this._options.hasOwnProperty(key)) {
throw Error('Option "' + key + '" is required for technology "' + this.getName() + '".');
}
return this._options[key];
},
/**
* Метод, осуществляющий сборку. Возвращает промис.
* Этот метод вызывается нодов для того, чтобы собрать таргет.
* В рамках этого метода нужно прочитать все исходные файлы и записать результат в конечный файл.
* @returns {Promise}
*/
Function (anonymous_160)
✗ Was not called
build: function () {···
throw new Error('You are required to override build method of BaseTech.');
},
build: function () {
throw new Error('You are required to override build method of BaseTech.');
},
/**
* Возвращает имя технологии.
*/
Function (anonymous_161)
✗ Was not called
getName: function () {···
throw new Error('You are required to override getName method of BaseTech.');
},
getName: function () {
throw new Error('You are required to override getName method of BaseTech.');
},
/**
* Возвращает таргеты, которые может собрать технология.
*/
Function (anonymous_162)
✗ Was not called
getTargets: function () {···
throw new Error('You are required to override getTargets method of BaseTech.');
},
getTargets: function () {
throw new Error('You are required to override getTargets method of BaseTech.');
},
/**
* Удаляет собранные таргеты.
* @returns {Promise}
*/
Function (anonymous_163)
✗ Was not called
clean: function () {···
var _this = this;
return Vow.all(this.getTargets().map(function (target) {
_this.node.cleanTargetFile(target);
}));
}
clean: function () {
var _this = this;
Function (anonymous_164)
✗ Was not called
return Vow.all(this.getTargets().map(function (target) {···
_this.node.cleanTargetFile(target);
}));
return Vow.all(this.getTargets().map(function (target) {
_this.node.cleanTargetFile(target);
}));
}
});
deps.js
/**
* Набор утилит для работы с deps'ами.
* @type {Object}
*/
module.exports = {
/**
* Объединяет deps'ы.
* @param {Array} depsToMerge
* @returns {Array}
*/
Function (anonymous_165)
✗ Was not called
merge: function (depsToMerge) {···
depsToMerge = [].concat(depsToMerge);
var startingDep = depsToMerge.shift();
var index = buildDepsIndex(startingDep);
var result = [].concat(startingDep);
var currentDep;
var dep;
var key;
while (!!(currentDep = depsToMerge.shift())) {
for (var i = 0, l = currentDep.length; i < l; i++) {
dep = currentDep[i];
key = depKey(dep);
if (!index[key]) {
result.push(dep);
index[key] = true;
}
}
}
return result;
},
merge: function (depsToMerge) {
depsToMerge = [].concat(depsToMerge);
var startingDep = depsToMerge.shift();
var index = buildDepsIndex(startingDep);
var result = [].concat(startingDep);
var currentDep;
var dep;
var key;
while (!!(currentDep = depsToMerge.shift())) {
for (var i = 0, l = currentDep.length; i < l; i++) {
dep = currentDep[i];
key = depKey(dep);
Branch IfStatement
✗ Positive was not executed (if)
if (!index[key]) {···
result.push(dep);
index[key] = true;
}
✗ Negative was not executed (else)
}···
}
if (!index[key]) {
result.push(dep);
index[key] = true;
}
}
}
return result;
},
/**
* Вычитает deps'ы.
* @param {Array} from
* @param {Array} what
* @returns {Array}
*/
Function (anonymous_166)
✗ Was not called
subtract: function (from, what) {···
var whatIndex = buildDepsIndex(what);
return from.filter(function (dep) {
return !whatIndex[depKey(dep)];
});
},
subtract: function (from, what) {
var whatIndex = buildDepsIndex(what);
Function (anonymous_167)
✗ Was not called
return from.filter(function (dep) {···
return !whatIndex[depKey(dep)];
});
return from.filter(function (dep) {
return !whatIndex[depKey(dep)];
});
},
/**
* Переводит bemdecl в deps'ы (без раскрытия).
* @param {Object} bemdecl
* @returns {Array}
*/
Function (anonymous_168)
✗ Was not called
fromBemdecl: function (bemdecl) {···
if (bemdecl.blocks) {
var res = [];
bemdecl.blocks.forEach(function (block) {
res.push({ block: block.name });
if (block.mods) {
block.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
}
if (block.elems) {
block.elems.forEach(function (elem) {
res.push({ block: block.name, elem: elem.name });
if (elem.mods) {
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
}
});
return res;
} else {
return this.flattenDeps(bemdecl.deps || []);
}
},
fromBemdecl: function (bemdecl) {
Branch IfStatement
✗ Positive was not executed (if)
if (bemdecl.blocks) {···
var res = [];
bemdecl.blocks.forEach(function (block) {
res.push({ block: block.name });
if (block.mods) {
block.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
}
if (block.elems) {
block.elems.forEach(function (elem) {
res.push({ block: block.name, elem: elem.name });
if (elem.mods) {
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
}
});
return res;
} else {
✗ Negative was not executed (else)
} else {···
return this.flattenDeps(bemdecl.deps || []);
}
if (bemdecl.blocks) {
var res = [];
Function (anonymous_169)
✗ Was not called
bemdecl.blocks.forEach(function (block) {···
res.push({ block: block.name });
if (block.mods) {
block.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
}
if (block.elems) {
block.elems.forEach(function (elem) {
res.push({ block: block.name, elem: elem.name });
if (elem.mods) {
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
}
});
bemdecl.blocks.forEach(function (block) {
res.push({ block: block.name });
Branch IfStatement
✗ Positive was not executed (if)
if (block.mods) {···
block.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
}
✗ Negative was not executed (else)
}···
if (block.elems) {
if (block.mods) {
Function (anonymous_170)
✗ Was not called
block.mods.forEach(function (mod) {···
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
block.mods.forEach(function (mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (mod.vals) {···
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
✗ Negative was not executed (else)
}···
});
if (mod.vals) {
Function (anonymous_171)
✗ Was not called
mod.vals.forEach(function (val) {···
res.push({ block: block.name, mod: mod.name, val: val.name});
});
mod.vals.forEach(function (val) {
res.push({ block: block.name, mod: mod.name, val: val.name});
});
}
});
}
Branch IfStatement
✗ Positive was not executed (if)
if (block.elems) {···
block.elems.forEach(function (elem) {
res.push({ block: block.name, elem: elem.name });
if (elem.mods) {
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
}
✗ Negative was not executed (else)
}···
});
if (block.elems) {
Function (anonymous_172)
✗ Was not called
block.elems.forEach(function (elem) {···
res.push({ block: block.name, elem: elem.name });
if (elem.mods) {
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
block.elems.forEach(function (elem) {
res.push({ block: block.name, elem: elem.name });
Branch IfStatement
✗ Positive was not executed (if)
if (elem.mods) {···
elem.mods.forEach(function (mod) {
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
✗ Negative was not executed (else)
}···
});
if (elem.mods) {
Function (anonymous_173)
✗ Was not called
elem.mods.forEach(function (mod) {···
if (mod.vals) {
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
elem.mods.forEach(function (mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (mod.vals) {···
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
✗ Negative was not executed (else)
}···
});
if (mod.vals) {
Function (anonymous_174)
✗ Was not called
mod.vals.forEach(function (val) {···
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
mod.vals.forEach(function (val) {
res.push({ block: block.name, elem: elem.name, mod: mod.name, val: val.name });
});
}
});
}
});
}
});
return res;
} else {
Branch LogicalExpression
✗ Was not returned
return this.flattenDeps(bemdecl.deps || []);
✗ Was not returned
return this.flattenDeps(bemdecl.deps || []);
return this.flattenDeps(bemdecl.deps || []);
}
},
/**
* Переводит deps'ы в bemdecl (без раскрытия).
* @param {Object} bemdecl
* @returns {Array}
*/
Function (anonymous_175)
✗ Was not called
toBemdecl: function (bemdecl) {···
if (bemdecl.deps) {
var res = [];
bemdecl.deps.forEach(function (dep) {
var item = { block: dep.block };
if (dep.elem) {
if (dep.mod) {
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
item.elems = [{ elem: dep.elem }];
}
} else {
if (dep.mod) {
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
}
res.push(item);
});
return res;
} else {
return bemdecl.blocks || [];
}
},
toBemdecl: function (bemdecl) {
Branch IfStatement
✗ Positive was not executed (if)
if (bemdecl.deps) {···
var res = [];
bemdecl.deps.forEach(function (dep) {
var item = { block: dep.block };
if (dep.elem) {
if (dep.mod) {
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
item.elems = [{ elem: dep.elem }];
}
} else {
if (dep.mod) {
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
}
res.push(item);
});
return res;
} else {
✗ Negative was not executed (else)
} else {···
return bemdecl.blocks || [];
}
if (bemdecl.deps) {
var res = [];
Function (anonymous_176)
✗ Was not called
bemdecl.deps.forEach(function (dep) {···
var item = { block: dep.block };
if (dep.elem) {
if (dep.mod) {
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
item.elems = [{ elem: dep.elem }];
}
} else {
if (dep.mod) {
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
}
res.push(item);
});
bemdecl.deps.forEach(function (dep) {
var item = { block: dep.block };
Branch IfStatement
✗ Positive was not executed (if)
if (dep.elem) {···
if (dep.mod) {
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
item.elems = [{ elem: dep.elem }];
}
} else {
✗ Negative was not executed (else)
} else {···
if (dep.mod) {
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
}
if (dep.elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mod) {···
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
✗ Negative was not executed (else)
} else {···
item.elems = [{ elem: dep.elem }];
}
if (dep.mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.val) {···
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
✗ Negative was not executed (else)
} else {···
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
if (dep.val) {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod, vals: [ { name: dep.val } ] }] }];
} else {
item.elems = [{ elem: dep.elem, mods: [{ name: dep.mod }] }];
}
} else {
item.elems = [{ elem: dep.elem }];
}
} else {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mod) {···
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
✗ Negative was not executed (else)
}···
}
if (dep.mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.val) {···
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
✗ Negative was not executed (else)
} else {···
item.mods = [{ name: dep.mod }];
}
if (dep.val) {
item.mods = [{ name: dep.mod, vals: [ { name: dep.val } ] }];
} else {
item.mods = [{ name: dep.mod }];
}
}
}
res.push(item);
});
return res;
} else {
Branch LogicalExpression
✗ Was not returned
return bemdecl.blocks || [];
✗ Was not returned
return bemdecl.blocks || [];
return bemdecl.blocks || [];
}
},
/**
* Конвертирует шорткаты депсов в массив без шорткатов.
* @param {Object} dep
* @param {String} [blockName]
* @returns {Array}
*/
Function (anonymous_177)
✗ Was not called
flattenDep: function (dep, blockName) {···
if (typeof dep === 'string') {
return [{ block: dep }];
}

var res = [];
if (!dep.block) {
dep.block = blockName;
}

if (dep.elem) {
if (dep.mods) {
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
});
} else if (dep.mod) {
if (dep.val) {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
} else {
res.push({ block: dep.block, elem: dep.elem });
}
} else if (dep.mods || dep.elems) {
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, mod: modName, val: modVal };
}));
});
if (dep.elems) {
res.push({ block: dep.block });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
}
} else if (dep.mod) {
if (dep.val) {
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, mod: dep.mod });
}
} else {
res = [{ block: dep.block }];
}
if (dep.tech) {
res.forEach(function (resDep) {
resDep.tech = dep.tech;
});
}
return res;
},
flattenDep: function (dep, blockName) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof dep === 'string') {···
return [{ block: dep }];
}
✗ Negative was not executed (else)
}···

var res = [];
if (typeof dep === 'string') {
return [{ block: dep }];
}
var res = [];
Branch IfStatement
✗ Positive was not executed (if)
if (!dep.block) {···
dep.block = blockName;
}
✗ Negative was not executed (else)
}···

if (dep.elem) {
if (!dep.block) {
dep.block = blockName;
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.elem) {···
if (dep.mods) {
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
});
} else if (dep.mod) {
if (dep.val) {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
} else {
res.push({ block: dep.block, elem: dep.elem });
}
} else if (dep.mods || dep.elems) {
✗ Negative was not executed (else)
} else if (dep.mods || dep.elems) {···
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, mod: modName, val: modVal };
}));
});
if (dep.elems) {
res.push({ block: dep.block });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
}
} else if (dep.mod) {
if (dep.val) {
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, mod: dep.mod });
}
} else {
res = [{ block: dep.block }];
}
if (dep.elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mods) {···
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
});
} else if (dep.mod) {
✗ Negative was not executed (else)
} else if (dep.mod) {···
if (dep.val) {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
} else {
res.push({ block: dep.block, elem: dep.elem });
}
if (dep.mods) {
Function (anonymous_178)
✗ Was not called
Object.keys(dep.mods).forEach(function (modName) {···
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
});
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_179)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: dep.elem, mod: modName, val: modVal };
}));
});
Branch IfStatement
✗ Positive was not executed (if)
} else if (dep.mod) {···
if (dep.val) {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
} else {
✗ Negative was not executed (else)
} else {···
res.push({ block: dep.block, elem: dep.elem });
}
} else if (dep.mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.val) {···
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
✗ Negative was not executed (else)
} else {···
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
if (dep.val) {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, elem: dep.elem, mod: dep.mod });
}
} else {
res.push({ block: dep.block, elem: dep.elem });
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (dep.mods || dep.elems) {···
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, mod: modName, val: modVal };
}));
});
if (dep.elems) {
res.push({ block: dep.block });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
}
} else if (dep.mod) {
✗ Negative was not executed (else)
} else if (dep.mod) {···
if (dep.val) {
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, mod: dep.mod });
}
} else {
res = [{ block: dep.block }];
}
Branch LogicalExpression
✗ Was not returned
} else if (dep.mods || dep.elems) {
✗ Was not returned
} else if (dep.mods || dep.elems) {
} else if (dep.mods || dep.elems) {
Function (anonymous_180)
✗ Was not called
Object.keys(dep.mods || {}).forEach(function (modName) {···
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, mod: modName, val: modVal };
}));
});
Branch LogicalExpression
✗ Was not returned
Object.keys(dep.mods || {}).forEach(function (modName) {
✗ Was not returned
Object.keys(dep.mods || {}).forEach(function (modName) {
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_181)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
return { block: dep.block, mod: modName, val: modVal };
}));
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, mod: modName, val: modVal };
}));
});
Branch IfStatement
✗ Positive was not executed (if)
if (dep.elems) {···
res.push({ block: dep.block });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
}
✗ Negative was not executed (else)
}···
} else if (dep.mod) {
if (dep.elems) {
res.push({ block: dep.block });
Branch LogicalExpression
✗ Was not returned
var elems = dep.elems || [];
✗ Was not returned
var elems = dep.elems || [];
var elems = dep.elems || [];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(elems)) {···
elems = [elems];
}
✗ Negative was not executed (else)
}···
elems.forEach(function (elem) {
if (!Array.isArray(elems)) {
elems = [elems];
}
Function (anonymous_182)
✗ Was not called
elems.forEach(function (elem) {···
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
elems.forEach(function (elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof elem === 'object') {···
res.push({ block: dep.block, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
✗ Negative was not executed (else)
} else {···
res.push({ block: dep.block, elem: elem });
}
if (typeof elem === 'object') {
res.push({ block: dep.block, elem: elem.elem });
Function (anonymous_183)
✗ Was not called
Object.keys(elem.mods || {}).forEach(function (modName) {···
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
Branch LogicalExpression
✗ Was not returned
Object.keys(elem.mods || {}).forEach(function (modName) {
✗ Was not returned
Object.keys(elem.mods || {}).forEach(function (modName) {
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_184)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
res = res.concat(modVals.map(function (modVal) {
return { block: dep.block, elem: elem.elem, mod: modName, val: modVal };
}));
});
} else {
res.push({ block: dep.block, elem: elem });
}
});
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (dep.mod) {···
if (dep.val) {
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, mod: dep.mod });
}
} else {
✗ Negative was not executed (else)
} else {···
res = [{ block: dep.block }];
}
} else if (dep.mod) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.val) {···
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
✗ Negative was not executed (else)
} else {···
res.push({ block: dep.block, mod: dep.mod });
}
if (dep.val) {
res.push({ block: dep.block, mod: dep.mod, val: dep.val });
} else {
res.push({ block: dep.block, mod: dep.mod });
}
} else {
res = [{ block: dep.block }];
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.tech) {···
res.forEach(function (resDep) {
resDep.tech = dep.tech;
});
}
✗ Negative was not executed (else)
}···
return res;
if (dep.tech) {
Function (anonymous_185)
✗ Was not called
res.forEach(function (resDep) {···
resDep.tech = dep.tech;
});
res.forEach(function (resDep) {
resDep.tech = dep.tech;
});
}
return res;
},
/**
* Корвертирует набор шорткатов депсов в массив без шорткатов.
* @param {Array|Object} deps
* @returns {Array}
*/
Function (anonymous_186)
✗ Was not called
flattenDeps: function (deps) {···
if (Array.isArray(deps)) {
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.flattenDep(deps[i]));
}
return result;
} else {
return this.flattenDep(deps);
}
}
flattenDeps: function (deps) {
Branch IfStatement
✗ Positive was not executed (if)
if (Array.isArray(deps)) {···
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.flattenDep(deps[i]));
}
return result;
} else {
✗ Negative was not executed (else)
} else {···
return this.flattenDep(deps);
}
if (Array.isArray(deps)) {
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.flattenDep(deps[i]));
}
return result;
} else {
return this.flattenDep(deps);
}
}
};
Function depKey
✗ Was not called
function depKey(dep) {···
return dep.block +
(dep.elem ? '__' + dep.elem : '') +
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
}
function depKey(dep) {
return dep.block +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(dep.elem ? '__' + dep.elem : '') +
✗ Negative was not returned (: ...)
(dep.elem ? '__' + dep.elem : '') +
(dep.elem ? '__' + dep.elem : '') +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
✗ Negative was not returned (: ...)
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
✗ Negative was not returned (: ...)
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
(dep.mod ? '_' + dep.mod + (dep.val ? '_' + dep.val : '') : '');
}
Function buildDepsIndex
✗ Was not called
function buildDepsIndex(deps) {···
var result = {};
for (var i = 0, l = deps.length; i < l; i++) {
result[depKey(deps[i])] = true;
}
return result;
}
function buildDepsIndex(deps) {
var result = {};
for (var i = 0, l = deps.length; i < l; i++) {
result[depKey(deps[i])] = true;
}
return result;
}
file-list.js
/**
* FileList
* ========
*/
var fs = require('fs');
var vowFs = require('./fs/async-fs');
var Vow = require('vow');
var inherit = require('inherit');
var path = require('path');
/**
* FileList — класс для работы со списком файлов.
* Умеет быстро выдавать файлы по суффиксу.
* @name FileList
* @class
*/
module.exports = inherit({
/**
* Конструктор.
*/
Function (anonymous_189)
✗ Was not called
__constructor: function () {···
this.items = [];
this.slices = [];
this.bySuffix = {};
},
__constructor: function () {
this.items = [];
this.slices = [];
this.bySuffix = {};
},
/**
* Добавляет файлы в FileList.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {Object[]} files
*/
Function (anonymous_190)
✗ Was not called
addFiles: function (files) {···
this.slices.push(files);
for (var i = 0, l = files.length; i < l; i++) {
var file = files[i];
this.items.push(file);
(this.bySuffix[file.suffix] || (this.bySuffix[file.suffix] = [])).push(file);
}
},
addFiles: function (files) {
this.slices.push(files);
for (var i = 0, l = files.length; i < l; i++) {
var file = files[i];
this.items.push(file);
Branch LogicalExpression
✗ Was not returned
(this.bySuffix[file.suffix] || (this.bySuffix[file.suffix] = [])).push(file);
✗ Was not returned
(this.bySuffix[file.suffix] || (this.bySuffix[file.suffix] = [])).push(file);
(this.bySuffix[file.suffix] || (this.bySuffix[file.suffix] = [])).push(file);
}
},
/**
* Возвращает файлы по суффиксу.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {String|String[]} suffix.
* @returns {Object[]}
*/
Function (anonymous_191)
✗ Was not called
getBySuffix: function (suffix) {···
if (Array.isArray(suffix) && suffix.length === 1) {
suffix = suffix[0];
}
if (Array.isArray(suffix)) {
var res = [];
this.slices.forEach(function (slice) {
suffix.forEach(function (s) {
for (var i = 0, l = slice.length; i < l; i++) {
var file = slice[i];
if (file.suffix === s) {
res.push(file);
}
}
});
});
return res;
} else {
return this.bySuffix[suffix] || [];
}
},
getBySuffix: function (suffix) {
Branch IfStatement
✗ Positive was not executed (if)
if (Array.isArray(suffix) && suffix.length === 1) {···
suffix = suffix[0];
}
✗ Negative was not executed (else)
}···
if (Array.isArray(suffix)) {
Branch LogicalExpression
✗ Was not returned
if (Array.isArray(suffix) && suffix.length === 1) {
✗ Was not returned
if (Array.isArray(suffix) && suffix.length === 1) {
if (Array.isArray(suffix) && suffix.length === 1) {
suffix = suffix[0];
}
Branch IfStatement
✗ Positive was not executed (if)
if (Array.isArray(suffix)) {···
var res = [];
this.slices.forEach(function (slice) {
suffix.forEach(function (s) {
for (var i = 0, l = slice.length; i < l; i++) {
var file = slice[i];
if (file.suffix === s) {
res.push(file);
}
}
});
});
return res;
} else {
✗ Negative was not executed (else)
} else {···
return this.bySuffix[suffix] || [];
}
if (Array.isArray(suffix)) {
var res = [];
Function (anonymous_192)
✗ Was not called
this.slices.forEach(function (slice) {···
suffix.forEach(function (s) {
for (var i = 0, l = slice.length; i < l; i++) {
var file = slice[i];
if (file.suffix === s) {
res.push(file);
}
}
});
});
this.slices.forEach(function (slice) {
Function (anonymous_193)
✗ Was not called
suffix.forEach(function (s) {···
for (var i = 0, l = slice.length; i < l; i++) {
var file = slice[i];
if (file.suffix === s) {
res.push(file);
}
}
});
suffix.forEach(function (s) {
for (var i = 0, l = slice.length; i < l; i++) {
var file = slice[i];
Branch IfStatement
✗ Positive was not executed (if)
if (file.suffix === s) {···
res.push(file);
}
✗ Negative was not executed (else)
}···
}
if (file.suffix === s) {
res.push(file);
}
}
});
});
return res;
} else {
Branch LogicalExpression
✗ Was not returned
return this.bySuffix[suffix] || [];
✗ Was not returned
return this.bySuffix[suffix] || [];
return this.bySuffix[suffix] || [];
}
},
/**
* Возвращает файлы по имени.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {String} name.
* @returns {Object[]}
*/
Function (anonymous_194)
✗ Was not called
getByName: function (name) {···
return this.items.filter(function (file) {
return file.name === name;
});
},
getByName: function (name) {
Function (anonymous_195)
✗ Was not called
return this.items.filter(function (file) {···
return file.name === name;
});
return this.items.filter(function (file) {
return file.name === name;
});
},
/**
* Синхронно загружает список файлов из директории.
* @param {String} dirname Абсолютный путь к директории.
* @param {Boolean} recursive Рекурсивная загрузка.
*/
Function (anonymous_196)
✗ Was not called
loadFromDirSync: function (dirname, recursive) {···
var files = [];
var _this = this;
filterFiles(fs.readdirSync(dirname)).forEach(function (filename) {
var fullname = dirname + '/' + filename;
var stat = fs.statSync(fullname);
if (stat.isFile()) {
files.push({
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
});
} else if (stat.isDirectory()) {
if (recursive) {
_this.loadFromDirSync(fullname, recursive);
}
}
});
this.addFiles(files);
},
loadFromDirSync: function (dirname, recursive) {
var files = [];
var _this = this;
Function (anonymous_197)
✗ Was not called
filterFiles(fs.readdirSync(dirname)).forEach(function (filename) {···
var fullname = dirname + '/' + filename;
var stat = fs.statSync(fullname);
if (stat.isFile()) {
files.push({
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
});
} else if (stat.isDirectory()) {
if (recursive) {
_this.loadFromDirSync(fullname, recursive);
}
}
});
filterFiles(fs.readdirSync(dirname)).forEach(function (filename) {
var fullname = dirname + '/' + filename;
var stat = fs.statSync(fullname);
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isFile()) {···
files.push({
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
});
} else if (stat.isDirectory()) {
✗ Negative was not executed (else)
} else if (stat.isDirectory()) {···
if (recursive) {
_this.loadFromDirSync(fullname, recursive);
}
}
if (stat.isFile()) {
files.push({
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
});
Branch IfStatement
✗ Positive was not executed (if)
} else if (stat.isDirectory()) {···
if (recursive) {
_this.loadFromDirSync(fullname, recursive);
}
}
✗ Negative was not executed (else)
}···
});
} else if (stat.isDirectory()) {
Branch IfStatement
✗ Positive was not executed (if)
if (recursive) {···
_this.loadFromDirSync(fullname, recursive);
}
✗ Negative was not executed (else)
}···
}
if (recursive) {
_this.loadFromDirSync(fullname, recursive);
}
}
});
this.addFiles(files);
},
/**
* Асинхронно загружает список файлов из директории.
* @param {String} dirname Абсолютный путь к директории.
* @param {Boolean} recursive Рекурсивная загрузка.
* @returns {Promise}
*/
Function (anonymous_198)
✗ Was not called
loadFromDir: function (dirname, recursive) {···
var _this = this;
return this._loadFromDir(dirname, recursive).then(function (files) {
_this.addFiles(files);
});
},
loadFromDir: function (dirname, recursive) {
var _this = this;
Function (anonymous_199)
✗ Was not called
return this._loadFromDir(dirname, recursive).then(function (files) {···
_this.addFiles(files);
});
return this._loadFromDir(dirname, recursive).then(function (files) {
_this.addFiles(files);
});
},
/**
* Асинхронно загружает список файлов из директории.
* @param {String} dirname
* @param {Boolean} recursive
* @returns {Promise}
* @private
*/
Function (anonymous_200)
✗ Was not called
_loadFromDir: function (dirname, recursive) {···
var _this = this;
return vowFs.listDir(dirname).then(function (filenames) {
return Vow.all(filenames.map(function (filename) {
var fullname = dirname + '/' + filename;
return vowFs.stat(fullname).then(function (stat) {
if (stat.isFile()) {
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
} else if (stat.isDirectory()) {
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
return [];
});
}));
}).then(function (fileLists) {
return [].concat.apply([], fileLists);
});
},
_loadFromDir: function (dirname, recursive) {
var _this = this;
Function (anonymous_201)
✗ Was not called
return vowFs.listDir(dirname).then(function (filenames) {···
return Vow.all(filenames.map(function (filename) {
var fullname = dirname + '/' + filename;
return vowFs.stat(fullname).then(function (stat) {
if (stat.isFile()) {
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
} else if (stat.isDirectory()) {
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
return [];
});
}));
}).then(function (fileLists) {
return vowFs.listDir(dirname).then(function (filenames) {
Function (anonymous_202)
✗ Was not called
return Vow.all(filenames.map(function (filename) {···
var fullname = dirname + '/' + filename;
return vowFs.stat(fullname).then(function (stat) {
if (stat.isFile()) {
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
} else if (stat.isDirectory()) {
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
return [];
});
}));
return Vow.all(filenames.map(function (filename) {
var fullname = dirname + '/' + filename;
Function (anonymous_203)
✗ Was not called
return vowFs.stat(fullname).then(function (stat) {···
if (stat.isFile()) {
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
} else if (stat.isDirectory()) {
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
return [];
});
return vowFs.stat(fullname).then(function (stat) {
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isFile()) {···
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
} else if (stat.isDirectory()) {
✗ Negative was not executed (else)
} else if (stat.isDirectory()) {···
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
if (stat.isFile()) {
return [{
name: filename,
fullname: fullname,
suffix: getSuffix(filename),
mtime: stat.mtime.getTime()
}];
Branch IfStatement
✗ Positive was not executed (if)
} else if (stat.isDirectory()) {···
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
✗ Negative was not executed (else)
}···
return [];
} else if (stat.isDirectory()) {
Branch IfStatement
✗ Positive was not executed (if)
if (recursive) {···
return _this._loadFromDir(fullname, recursive);
}
✗ Negative was not executed (else)
}···
}
if (recursive) {
return _this._loadFromDir(fullname, recursive);
}
}
return [];
});
}));
Function (anonymous_204)
✗ Was not called
}).then(function (fileLists) {···
return [].concat.apply([], fileLists);
});
}).then(function (fileLists) {
return [].concat.apply([], fileLists);
});
},
/**
* Разбирает имя файла, извлекая данные BEM-сущности.
* Формат ответа:
* {
* filenameWithoutSuffix: <имя файла без суффикса>,
* suffix: <суффикс>,
* bem: {
* block: ...,
* elem: ...,
* modName: ...,
* modVal: ...
* },
* bemdecl: <bemdecl-формат>
* };
* @returns {Object}
*/
parseFilename: parseFilename,
/**
* Возвращает информацию о файле в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
*/
getFileInfo: getFileInfo
}, {
parseFilename: parseFilename,
getFileInfo: getFileInfo
});
Function getFileInfo
✗ Was not called
function getFileInfo(filename) {···
var baseName = path.basename(filename);
var suffix = baseName.split('.').slice(1).join('.');
var stat = fs.statSync(filename);
return {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
}
function getFileInfo(filename) {
var baseName = path.basename(filename);
var suffix = baseName.split('.').slice(1).join('.');
var stat = fs.statSync(filename);
return {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
}
Function parseFilename
✗ Was not called
function parseFilename(filename) {···
var filenameParts = filename.split('.');
var filenameWithoutSuffix = filenameParts[0];
var suffix = filenameParts.slice(1).join('.');
var bem = {};
var modParts;
if (~filenameWithoutSuffix.indexOf('__')) {
var blockElemParts = filenameWithoutSuffix.split('__');
bem.block = blockElemParts[0];
var elemParts = blockElemParts[1].split('_');
bem.elem = elemParts[0];
modParts = elemParts.slice(1);
} else {
var blockParts = filenameWithoutSuffix.split('_');
bem.block = blockParts[0];
modParts = blockParts.slice(1);
}
if (modParts.length) {
bem.modName = modParts[0];
bem.modVal = modParts[1] || '';
}
var bemdecl = {
name: bem.block
};
if (bem.elem) {
if (bem.modName) {
bemdecl.elems = [{ name: bem.elem, mods: [{ name: bem.modName, vals: [ {name: bem.modVal} ] }]}];
} else {
bemdecl.elems = [{ name: bem.elem }];
}
} else if (bem.modName) {
bemdecl.mods = [{ name: bem.modName, vals: [ {name: bem.modVal} ] }];
}
return {
filenameWithoutSuffix: filenameWithoutSuffix,
suffix: suffix,
bem: bem,
bemdecl: bemdecl
};
}
function parseFilename(filename) {
var filenameParts = filename.split('.');
var filenameWithoutSuffix = filenameParts[0];
var suffix = filenameParts.slice(1).join('.');
var bem = {};
var modParts;
Branch IfStatement
✗ Positive was not executed (if)
if (~filenameWithoutSuffix.indexOf('__')) {···
var blockElemParts = filenameWithoutSuffix.split('__');
bem.block = blockElemParts[0];
var elemParts = blockElemParts[1].split('_');
bem.elem = elemParts[0];
modParts = elemParts.slice(1);
} else {
✗ Negative was not executed (else)
} else {···
var blockParts = filenameWithoutSuffix.split('_');
bem.block = blockParts[0];
modParts = blockParts.slice(1);
}
if (~filenameWithoutSuffix.indexOf('__')) {
var blockElemParts = filenameWithoutSuffix.split('__');
bem.block = blockElemParts[0];
var elemParts = blockElemParts[1].split('_');
bem.elem = elemParts[0];
modParts = elemParts.slice(1);
} else {
var blockParts = filenameWithoutSuffix.split('_');
bem.block = blockParts[0];
modParts = blockParts.slice(1);
}
Branch IfStatement
✗ Positive was not executed (if)
if (modParts.length) {···
bem.modName = modParts[0];
bem.modVal = modParts[1] || '';
}
✗ Negative was not executed (else)
}···
var bemdecl = {
if (modParts.length) {
bem.modName = modParts[0];
Branch LogicalExpression
✗ Was not returned
bem.modVal = modParts[1] || '';
✗ Was not returned
bem.modVal = modParts[1] || '';
bem.modVal = modParts[1] || '';
}
var bemdecl = {
name: bem.block
};
Branch IfStatement
✗ Positive was not executed (if)
if (bem.elem) {···
if (bem.modName) {
bemdecl.elems = [{ name: bem.elem, mods: [{ name: bem.modName, vals: [ {name: bem.modVal} ] }]}];
} else {
bemdecl.elems = [{ name: bem.elem }];
}
} else if (bem.modName) {
✗ Negative was not executed (else)
} else if (bem.modName) {···
bemdecl.mods = [{ name: bem.modName, vals: [ {name: bem.modVal} ] }];
}
if (bem.elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (bem.modName) {···
bemdecl.elems = [{ name: bem.elem, mods: [{ name: bem.modName, vals: [ {name: bem.modVal} ] }]}];
} else {
✗ Negative was not executed (else)
} else {···
bemdecl.elems = [{ name: bem.elem }];
}
if (bem.modName) {
bemdecl.elems = [{ name: bem.elem, mods: [{ name: bem.modName, vals: [ {name: bem.modVal} ] }]}];
} else {
bemdecl.elems = [{ name: bem.elem }];
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (bem.modName) {···
bemdecl.mods = [{ name: bem.modName, vals: [ {name: bem.modVal} ] }];
}
✗ Negative was not executed (else)
}···
return {
} else if (bem.modName) {
bemdecl.mods = [{ name: bem.modName, vals: [ {name: bem.modVal} ] }];
}
return {
filenameWithoutSuffix: filenameWithoutSuffix,
suffix: suffix,
bem: bem,
bemdecl: bemdecl
};
}
Function filterFiles
✗ Was not called
function filterFiles(filenames) {···
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
function filterFiles(filenames) {
Function (anonymous_208)
✗ Was not called
return filenames.filter(function (filename) {···
return filename.charAt(0) !== '.';
});
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
Function getSuffix
✗ Was not called
function getSuffix(filename) {···
return filename.split('.').slice(1).join('.');
}
function getSuffix(filename) {
return filename.split('.').slice(1).join('.');
}
deps-resolver.js
/**
* DepsResolver
* ============
*/
var inherit = require('inherit');
var vm = require('vm');
var Vow = require('vow');
var vowFs = require('../fs/async-fs');
var yaml = require('js-yaml');
Function DepsError
✗ Was not called
function DepsError(message) {···
this.message = message;
Error.captureStackTrace(this, DepsError);
}
function DepsError(message) {
this.message = message;
Error.captureStackTrace(this, DepsError);
}
DepsError.prototype = Object.create(Error.prototype);
DepsError.prototype.name = 'Deps error';
/**
* DepsResolver — класс, раскрывающий deps'ы.
* @name DepsResolver
*/
module.exports = inherit({
/**
* Конструктор.
* @param {Level[]} levels
*/
Function (anonymous_211)
✗ Was not called
__constructor: function (levels) {···
this.levels = levels;
this.declarations = [];
this.resolved = {};
this.declarationIndex = {};
},
__constructor: function (levels) {
this.levels = levels;
this.declarations = [];
this.resolved = {};
this.declarationIndex = {};
},
/**
* Раскрывает шорткаты deps'а.
* @param {String|Object} dep
* @param {String} blockName
* @param {String} elemName
* @returns {Array}
*/
Function (anonymous_212)
✗ Was not called
normalizeDep: function (dep, blockName, elemName) {···
var levels = this.levels;
if (typeof dep === 'string') {
return [{ name: dep }];
} else {
var res = [];
if (!dep || !(dep instanceof Object)) {
throw new DepsError('Deps shoud be instance of Object or String');
}
if (dep.view) {
(dep.mods || (dep.mods = {})).view = dep.view;
}
if (dep.skin) {
(dep.mods || (dep.mods = {})).skin = dep.skin;
}
if (dep.elem) {
if (dep.mods) {
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
} else if (dep.mod) {
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
res.push({ name: dep.block || blockName, elem: dep.elem });
}
} else if (dep.mod || dep.mods || dep.elems) {
if (dep.mod) {
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (modVals === '*') {
modVals = levels.getModValues(dep.block || blockName, modName);
}
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
if (dep.elems) {
res.push({ name: dep.block || blockName });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
} else {
res = [{ name: dep.block || blockName }];
}
if (dep.required) {
res.forEach(function (subDep) {
subDep.required = true;
});
}
return res;
}
},
normalizeDep: function (dep, blockName, elemName) {
var levels = this.levels;
Branch IfStatement
✗ Positive was not executed (if)
if (typeof dep === 'string') {···
return [{ name: dep }];
} else {
✗ Negative was not executed (else)
} else {···
var res = [];
if (!dep || !(dep instanceof Object)) {
throw new DepsError('Deps shoud be instance of Object or String');
}
if (dep.view) {
(dep.mods || (dep.mods = {})).view = dep.view;
}
if (dep.skin) {
(dep.mods || (dep.mods = {})).skin = dep.skin;
}
if (dep.elem) {
if (dep.mods) {
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
} else if (dep.mod) {
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
res.push({ name: dep.block || blockName, elem: dep.elem });
}
} else if (dep.mod || dep.mods || dep.elems) {
if (dep.mod) {
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (modVals === '*') {
modVals = levels.getModValues(dep.block || blockName, modName);
}
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
if (dep.elems) {
res.push({ name: dep.block || blockName });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
} else {
res = [{ name: dep.block || blockName }];
}
if (dep.required) {
res.forEach(function (subDep) {
subDep.required = true;
});
}
return res;
}
if (typeof dep === 'string') {
return [{ name: dep }];
} else {
var res = [];
Branch IfStatement
✗ Positive was not executed (if)
if (!dep || !(dep instanceof Object)) {···
throw new DepsError('Deps shoud be instance of Object or String');
}
✗ Negative was not executed (else)
}···
if (dep.view) {
Branch LogicalExpression
✗ Was not returned
if (!dep || !(dep instanceof Object)) {
✗ Was not returned
if (!dep || !(dep instanceof Object)) {
if (!dep || !(dep instanceof Object)) {
throw new DepsError('Deps shoud be instance of Object or String');
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.view) {···
(dep.mods || (dep.mods = {})).view = dep.view;
}
✗ Negative was not executed (else)
}···
if (dep.skin) {
if (dep.view) {
Branch LogicalExpression
✗ Was not returned
(dep.mods || (dep.mods = {})).view = dep.view;
✗ Was not returned
(dep.mods || (dep.mods = {})).view = dep.view;
(dep.mods || (dep.mods = {})).view = dep.view;
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.skin) {···
(dep.mods || (dep.mods = {})).skin = dep.skin;
}
✗ Negative was not executed (else)
}···
if (dep.elem) {
if (dep.skin) {
Branch LogicalExpression
✗ Was not returned
(dep.mods || (dep.mods = {})).skin = dep.skin;
✗ Was not returned
(dep.mods || (dep.mods = {})).skin = dep.skin;
(dep.mods || (dep.mods = {})).skin = dep.skin;
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.elem) {···
if (dep.mods) {
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
} else if (dep.mod) {
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
res.push({ name: dep.block || blockName, elem: dep.elem });
}
} else if (dep.mod || dep.mods || dep.elems) {
✗ Negative was not executed (else)
} else if (dep.mod || dep.mods || dep.elems) {···
if (dep.mod) {
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (modVals === '*') {
modVals = levels.getModValues(dep.block || blockName, modName);
}
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
if (dep.elems) {
res.push({ name: dep.block || blockName });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
} else {
res = [{ name: dep.block || blockName }];
}
if (dep.elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mods) {···
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
} else if (dep.mod) {
✗ Negative was not executed (else)
} else if (dep.mod) {···
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
res.push({ name: dep.block || blockName, elem: dep.elem });
}
if (dep.mods) {
Function (anonymous_213)
✗ Was not called
Object.keys(dep.mods).forEach(function (modName) {···
var modVals = dep.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
Object.keys(dep.mods).forEach(function (modName) {
var modVals = dep.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_214)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
res = res.concat(modVals.map(function (modVal) {
Branch LogicalExpression
✗ Was not returned
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
✗ Was not returned
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
return { name: dep.block || blockName, elem: dep.elem, modName: modName, modVal: modVal };
}));
});
Branch IfStatement
✗ Positive was not executed (if)
} else if (dep.mod) {···
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
✗ Negative was not executed (else)
} else {···
res.push({ name: dep.block || blockName, elem: dep.elem });
}
} else if (dep.mod) {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
✗ Was not returned
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
res.push({ name: dep.block || blockName, elem: dep.elem, modName: dep.mod, modVal: dep.val });
} else {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName, elem: dep.elem });
✗ Was not returned
res.push({ name: dep.block || blockName, elem: dep.elem });
res.push({ name: dep.block || blockName, elem: dep.elem });
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (dep.mod || dep.mods || dep.elems) {···
if (dep.mod) {
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
if (modVals === '*') {
modVals = levels.getModValues(dep.block || blockName, modName);
}
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
if (dep.elems) {
res.push({ name: dep.block || blockName });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
} else {
✗ Negative was not executed (else)
} else {···
res = [{ name: dep.block || blockName }];
}
Branch LogicalExpression
✗ Was not returned
} else if (dep.mod || dep.mods || dep.elems) {
✗ Was not returned
} else if (dep.mod || dep.mods || dep.elems) {
Branch LogicalExpression
✗ Was not returned
} else if (dep.mod || dep.mods || dep.elems) {
✗ Was not returned
} else if (dep.mod || dep.mods || dep.elems) {
} else if (dep.mod || dep.mods || dep.elems) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mod) {···
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
✗ Negative was not executed (else)
}···
Object.keys(dep.mods || {}).forEach(function (modName) {
if (dep.mod) {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
✗ Was not returned
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
res.push({ name: dep.block || blockName, modName: dep.mod, modVal: dep.val });
}
Function (anonymous_215)
✗ Was not called
Object.keys(dep.mods || {}).forEach(function (modName) {···
var modVals = dep.mods[modName];
if (modVals === '*') {
modVals = levels.getModValues(dep.block || blockName, modName);
}
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
Branch LogicalExpression
✗ Was not returned
Object.keys(dep.mods || {}).forEach(function (modName) {
✗ Was not returned
Object.keys(dep.mods || {}).forEach(function (modName) {
Object.keys(dep.mods || {}).forEach(function (modName) {
var modVals = dep.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (modVals === '*') {···
modVals = levels.getModValues(dep.block || blockName, modName);
}
✗ Negative was not executed (else)
}···
if (!Array.isArray(modVals)) {
if (modVals === '*') {
Branch LogicalExpression
✗ Was not returned
modVals = levels.getModValues(dep.block || blockName, modName);
✗ Was not returned
modVals = levels.getModValues(dep.block || blockName, modName);
modVals = levels.getModValues(dep.block || blockName, modName);
}
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_216)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
if (elemName && !dep.block && !dep.elem) {
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
res = res.concat(modVals.map(function (modVal) {
Branch IfStatement
✗ Positive was not executed (if)
if (elemName && !dep.block && !dep.elem) {···
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
✗ Negative was not executed (else)
} else {···
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
Branch LogicalExpression
✗ Was not returned
if (elemName && !dep.block && !dep.elem) {
✗ Was not returned
if (elemName && !dep.block && !dep.elem) {
Branch LogicalExpression
✗ Was not returned
if (elemName && !dep.block && !dep.elem) {
✗ Was not returned
if (elemName && !dep.block && !dep.elem) {
if (elemName && !dep.block && !dep.elem) {
Branch LogicalExpression
✗ Was not returned
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
✗ Was not returned
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
return { name: dep.block || blockName, elem: elemName, modName: modName, modVal: modVal };
} else {
Branch LogicalExpression
✗ Was not returned
return { name: dep.block || blockName, modName: modName, modVal: modVal };
✗ Was not returned
return { name: dep.block || blockName, modName: modName, modVal: modVal };
return { name: dep.block || blockName, modName: modName, modVal: modVal };
}
}));
});
Branch IfStatement
✗ Positive was not executed (if)
if (dep.elems) {···
res.push({ name: dep.block || blockName });
var elems = dep.elems || [];
if (!Array.isArray(elems)) {
elems = [elems];
}
elems.forEach(function (elem) {
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
✗ Negative was not executed (else)
}···
} else {
if (dep.elems) {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName });
✗ Was not returned
res.push({ name: dep.block || blockName });
res.push({ name: dep.block || blockName });
Branch LogicalExpression
✗ Was not returned
var elems = dep.elems || [];
✗ Was not returned
var elems = dep.elems || [];
var elems = dep.elems || [];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(elems)) {···
elems = [elems];
}
✗ Negative was not executed (else)
}···
elems.forEach(function (elem) {
if (!Array.isArray(elems)) {
elems = [elems];
}
Function (anonymous_217)
✗ Was not called
elems.forEach(function (elem) {···
if (typeof elem === 'object') {
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
res.push({ name: dep.block || blockName, elem: elem });
}
});
elems.forEach(function (elem) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof elem === 'object') {···
res.push({ name: dep.block || blockName, elem: elem.elem });
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
✗ Negative was not executed (else)
} else {···
res.push({ name: dep.block || blockName, elem: elem });
}
if (typeof elem === 'object') {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName, elem: elem.elem });
✗ Was not returned
res.push({ name: dep.block || blockName, elem: elem.elem });
res.push({ name: dep.block || blockName, elem: elem.elem });
Function (anonymous_218)
✗ Was not called
Object.keys(elem.mods || {}).forEach(function (modName) {···
var modVals = elem.mods[modName];
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
res = res.concat(modVals.map(function (modVal) {
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
Branch LogicalExpression
✗ Was not returned
Object.keys(elem.mods || {}).forEach(function (modName) {
✗ Was not returned
Object.keys(elem.mods || {}).forEach(function (modName) {
Object.keys(elem.mods || {}).forEach(function (modName) {
var modVals = elem.mods[modName];
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(modVals)) {···
modVals = [modVals];
}
✗ Negative was not executed (else)
}···
res = res.concat(modVals.map(function (modVal) {
if (!Array.isArray(modVals)) {
modVals = [modVals];
}
Function (anonymous_219)
✗ Was not called
res = res.concat(modVals.map(function (modVal) {···
return {
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
res = res.concat(modVals.map(function (modVal) {
return {
Branch LogicalExpression
✗ Was not returned
name: dep.block || blockName,
✗ Was not returned
name: dep.block || blockName,
name: dep.block || blockName,
elem: elem.elem,
modName: modName,
modVal: modVal
};
}));
});
} else {
Branch LogicalExpression
✗ Was not returned
res.push({ name: dep.block || blockName, elem: elem });
✗ Was not returned
res.push({ name: dep.block || blockName, elem: elem });
res.push({ name: dep.block || blockName, elem: elem });
}
});
}
} else {
Branch LogicalExpression
✗ Was not returned
res = [{ name: dep.block || blockName }];
✗ Was not returned
res = [{ name: dep.block || blockName }];
res = [{ name: dep.block || blockName }];
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.required) {···
res.forEach(function (subDep) {
subDep.required = true;
});
}
✗ Negative was not executed (else)
}···
return res;
if (dep.required) {
Function (anonymous_220)
✗ Was not called
res.forEach(function (subDep) {···
subDep.required = true;
});
res.forEach(function (subDep) {
subDep.required = true;
});
}
return res;
}
},
/**
* Раскрывает шорткаты для списка deps'ов.
* @param {String|Object|Array} deps
* @param {String} [blockName]
* @param {String} [elemName]
* @returns {Array}
*/
Function (anonymous_221)
✗ Was not called
normalizeDeps: function (deps, blockName, elemName) {···
if (Array.isArray(deps)) {
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.normalizeDep(deps[i], blockName, elemName));
}
return result;
} else {
return this.normalizeDep(deps, blockName, elemName);
}
},
normalizeDeps: function (deps, blockName, elemName) {
Branch IfStatement
✗ Positive was not executed (if)
if (Array.isArray(deps)) {···
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.normalizeDep(deps[i], blockName, elemName));
}
return result;
} else {
✗ Negative was not executed (else)
} else {···
return this.normalizeDep(deps, blockName, elemName);
}
if (Array.isArray(deps)) {
var result = [];
for (var i = 0, l = deps.length; i < l; i++) {
result = result.concat(this.normalizeDep(deps[i], blockName, elemName));
}
return result;
} else {
return this.normalizeDep(deps, blockName, elemName);
}
},
/**
* Возвращает deps'ы для декларации (с помощью levels).
* @param {Object} decl
* @returns {{mustDeps: Array, shouldDeps: Array}}
*/
Function (anonymous_222)
✗ Was not called
getDeps: function (decl) {···
var _this = this;
var mustDecls;
var files;
if (decl.elem) {
files = this.levels.getElemFiles(decl.name, decl.elem, decl.modName, decl.modVal);
} else {
files = this.levels.getBlockFiles(decl.name, decl.modName, decl.modVal);
}
files = files.filter(function (file) {
return file.suffix === 'deps.js' || file.suffix === 'deps.yaml';
});
var mustDepIndex = {};
var shouldDepIndex = {};
mustDepIndex[declKey(decl)] = true;
var mustDeps = [];
if (decl.modName) {
if (decl.elem) {
mustDecls = [
{ name: decl.name, elem: decl.elem }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, elem: decl.elem, modName: decl.modName });
}
} else {
mustDecls = [
{ name: decl.name }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, modName: decl.modName });
}
}
mustDecls.forEach(function (mustDecl) {
mustDecl.key = declKey(mustDecl);
mustDepIndex[mustDecl.key] = true;
mustDeps.push(mustDecl);
});
}
var shouldDeps = [];

function keepWorking(file) {
return vowFs.read(file.fullname, 'utf8').then(function (depContent) {
if (file.suffix === 'deps.js') {
var depData;
try {
depData = vm.runInThisContext(depContent);
} catch (e) {
throw new Error('Syntax error in file "' + file.fullname + '": ' + e.message);
}
depData = Array.isArray(depData) ? depData : [depData];
depData.forEach(function (dep) {
if (!dep.tech) {
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
} else if (file.suffix === 'deps.yaml') {
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
if (files.length > 0) {
return keepWorking(files.shift());
} else {
return null;
}
}).fail(function (err) {
if (err instanceof DepsError) {
err.message += ' in file "' + file.fullname + '"';
}
throw err;
});
}

function removeFromDeps(decl, index, list) {
if (index[decl.key]) {
for (var i = 0, l = list.length; i < l; i++) {
if (list[i].key === decl.key) {
return list.splice(i, 1);
}
}
} else {
index[decl.key] = true;
}
return null;
}

var result = { mustDeps: mustDeps, shouldDeps: shouldDeps };

if (files.length > 0) {
return keepWorking(files.shift()).then(function () {
return result;
});
} else {
return Vow.fulfill(result);
}
},
getDeps: function (decl) {
var _this = this;
var mustDecls;
var files;
Branch IfStatement
✗ Positive was not executed (if)
if (decl.elem) {···
files = this.levels.getElemFiles(decl.name, decl.elem, decl.modName, decl.modVal);
} else {
✗ Negative was not executed (else)
} else {···
files = this.levels.getBlockFiles(decl.name, decl.modName, decl.modVal);
}
if (decl.elem) {
files = this.levels.getElemFiles(decl.name, decl.elem, decl.modName, decl.modVal);
} else {
files = this.levels.getBlockFiles(decl.name, decl.modName, decl.modVal);
}
Function (anonymous_223)
✗ Was not called
files = files.filter(function (file) {···
return file.suffix === 'deps.js' || file.suffix === 'deps.yaml';
});
files = files.filter(function (file) {
Branch LogicalExpression
✗ Was not returned
return file.suffix === 'deps.js' || file.suffix === 'deps.yaml';
✗ Was not returned
return file.suffix === 'deps.js' || file.suffix === 'deps.yaml';
return file.suffix === 'deps.js' || file.suffix === 'deps.yaml';
});
var mustDepIndex = {};
var shouldDepIndex = {};
mustDepIndex[declKey(decl)] = true;
var mustDeps = [];
Branch IfStatement
✗ Positive was not executed (if)
if (decl.modName) {···
if (decl.elem) {
mustDecls = [
{ name: decl.name, elem: decl.elem }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, elem: decl.elem, modName: decl.modName });
}
} else {
mustDecls = [
{ name: decl.name }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, modName: decl.modName });
}
}
mustDecls.forEach(function (mustDecl) {
mustDecl.key = declKey(mustDecl);
mustDepIndex[mustDecl.key] = true;
mustDeps.push(mustDecl);
});
}
✗ Negative was not executed (else)
}···
var shouldDeps = [];
if (decl.modName) {
Branch IfStatement
✗ Positive was not executed (if)
if (decl.elem) {···
mustDecls = [
{ name: decl.name, elem: decl.elem }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, elem: decl.elem, modName: decl.modName });
}
} else {
✗ Negative was not executed (else)
} else {···
mustDecls = [
{ name: decl.name }
];
if (decl.modVal) {
mustDecls.push({ name: decl.name, modName: decl.modName });
}
}
if (decl.elem) {
mustDecls = [
{ name: decl.name, elem: decl.elem }
];
Branch IfStatement
✗ Positive was not executed (if)
if (decl.modVal) {···
mustDecls.push({ name: decl.name, elem: decl.elem, modName: decl.modName });
}
✗ Negative was not executed (else)
}···
} else {
if (decl.modVal) {
mustDecls.push({ name: decl.name, elem: decl.elem, modName: decl.modName });
}
} else {
mustDecls = [
{ name: decl.name }
];
Branch IfStatement
✗ Positive was not executed (if)
if (decl.modVal) {···
mustDecls.push({ name: decl.name, modName: decl.modName });
}
✗ Negative was not executed (else)
}···
}
if (decl.modVal) {
mustDecls.push({ name: decl.name, modName: decl.modName });
}
}
Function (anonymous_224)
✗ Was not called
mustDecls.forEach(function (mustDecl) {···
mustDecl.key = declKey(mustDecl);
mustDepIndex[mustDecl.key] = true;
mustDeps.push(mustDecl);
});
mustDecls.forEach(function (mustDecl) {
mustDecl.key = declKey(mustDecl);
mustDepIndex[mustDecl.key] = true;
mustDeps.push(mustDecl);
});
}
var shouldDeps = [];
Function keepWorking
✗ Was not called
function keepWorking(file) {···
return vowFs.read(file.fullname, 'utf8').then(function (depContent) {
if (file.suffix === 'deps.js') {
var depData;
try {
depData = vm.runInThisContext(depContent);
} catch (e) {
throw new Error('Syntax error in file "' + file.fullname + '": ' + e.message);
}
depData = Array.isArray(depData) ? depData : [depData];
depData.forEach(function (dep) {
if (!dep.tech) {
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
} else if (file.suffix === 'deps.yaml') {
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
if (files.length > 0) {
return keepWorking(files.shift());
} else {
return null;
}
}).fail(function (err) {
if (err instanceof DepsError) {
err.message += ' in file "' + file.fullname + '"';
}
throw err;
});
}
function keepWorking(file) {
Function (anonymous_226)
✗ Was not called
return vowFs.read(file.fullname, 'utf8').then(function (depContent) {···
if (file.suffix === 'deps.js') {
var depData;
try {
depData = vm.runInThisContext(depContent);
} catch (e) {
throw new Error('Syntax error in file "' + file.fullname + '": ' + e.message);
}
depData = Array.isArray(depData) ? depData : [depData];
depData.forEach(function (dep) {
if (!dep.tech) {
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
} else if (file.suffix === 'deps.yaml') {
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
if (files.length > 0) {
return keepWorking(files.shift());
} else {
return null;
}
}).fail(function (err) {
return vowFs.read(file.fullname, 'utf8').then(function (depContent) {
Branch IfStatement
✗ Positive was not executed (if)
if (file.suffix === 'deps.js') {···
var depData;
try {
depData = vm.runInThisContext(depContent);
} catch (e) {
throw new Error('Syntax error in file "' + file.fullname + '": ' + e.message);
}
depData = Array.isArray(depData) ? depData : [depData];
depData.forEach(function (dep) {
if (!dep.tech) {
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
} else if (file.suffix === 'deps.yaml') {
✗ Negative was not executed (else)
} else if (file.suffix === 'deps.yaml') {···
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
if (file.suffix === 'deps.js') {
var depData;
try {
depData = vm.runInThisContext(depContent);
} catch (e) {
throw new Error('Syntax error in file "' + file.fullname + '": ' + e.message);
}
Branch ConditionalExpression
✗ Positive was not returned (? ...)
depData = Array.isArray(depData) ? depData : [depData];
✗ Negative was not returned (: ...)
depData = Array.isArray(depData) ? depData : [depData];
depData = Array.isArray(depData) ? depData : [depData];
Function (anonymous_227)
✗ Was not called
depData.forEach(function (dep) {···
if (!dep.tech) {
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
depData.forEach(function (dep) {
Branch IfStatement
✗ Positive was not executed (if)
if (!dep.tech) {···
if (dep.mustDeps) {
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
if (dep.shouldDeps) {
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
if (dep.noDeps) {
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
✗ Negative was not executed (else)
}···
});
if (!dep.tech) {
Branch IfStatement
✗ Positive was not executed (if)
if (dep.mustDeps) {···
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
✗ Negative was not executed (else)
}···
if (dep.shouldDeps) {
if (dep.mustDeps) {
Function (anonymous_228)
✗ Was not called
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {···
var key = declKey(nd);
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
_this.normalizeDeps(dep.mustDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
Branch IfStatement
✗ Positive was not executed (if)
if (!mustDepIndex[key]) {···
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
✗ Negative was not executed (else)
}···
});
if (!mustDepIndex[key]) {
mustDepIndex[key] = true;
nd.key = key;
mustDeps.push(nd);
}
});
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.shouldDeps) {···
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
✗ Negative was not executed (else)
}···
if (dep.noDeps) {
if (dep.shouldDeps) {
Function (anonymous_229)
✗ Was not called
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {···
var key = declKey(nd);
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
_this.normalizeDeps(dep.shouldDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
Branch IfStatement
✗ Positive was not executed (if)
if (!shouldDepIndex[key]) {···
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
✗ Negative was not executed (else)
}···
});
if (!shouldDepIndex[key]) {
shouldDepIndex[key] = true;
nd.key = key;
shouldDeps.push(nd);
}
});
}
Branch IfStatement
✗ Positive was not executed (if)
if (dep.noDeps) {···
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
✗ Negative was not executed (else)
}···
}
if (dep.noDeps) {
Function (anonymous_230)
✗ Was not called
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {···
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
_this.normalizeDeps(dep.noDeps, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
nd.key = key;
removeFromDeps(nd, mustDepIndex, mustDeps);
removeFromDeps(nd, shouldDepIndex, shouldDeps);
});
}
}
});
Branch IfStatement
✗ Positive was not executed (if)
} else if (file.suffix === 'deps.yaml') {···
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
✗ Negative was not executed (else)
}···
if (files.length > 0) {
} else if (file.suffix === 'deps.yaml') {
var depYamlStructure = yaml.safeLoad(depContent, {
filename: file.fullname,
strict: true
});
Branch IfStatement
✗ Positive was not executed (if)
if (!Array.isArray(depYamlStructure)) {···
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
✗ Negative was not executed (else)
}···
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
if (!Array.isArray(depYamlStructure)) {
throw new Error('Invalid yaml deps structure at: ' + file.fullname);
}
Function (anonymous_231)
✗ Was not called
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {···
var key = declKey(nd);
var index;
var depList;
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
_this.normalizeDeps(depYamlStructure, decl.name, decl.elem).forEach(function (nd) {
var key = declKey(nd);
var index;
var depList;
Branch IfStatement
✗ Positive was not executed (if)
if (nd.required) {···
index = mustDepIndex;
depList = mustDeps;
} else {
✗ Negative was not executed (else)
} else {···
index = shouldDepIndex;
depList = shouldDeps;
}
if (nd.required) {
index = mustDepIndex;
depList = mustDeps;
} else {
index = shouldDepIndex;
depList = shouldDeps;
}
Branch IfStatement
✗ Positive was not executed (if)
if (!index[key]) {···
index[key] = true;
nd.key = key;
depList.push(nd);
}
✗ Negative was not executed (else)
}···
});
if (!index[key]) {
index[key] = true;
nd.key = key;
depList.push(nd);
}
});
}
Branch IfStatement
✗ Positive was not executed (if)
if (files.length > 0) {···
return keepWorking(files.shift());
} else {
✗ Negative was not executed (else)
} else {···
return null;
}
if (files.length > 0) {
return keepWorking(files.shift());
} else {
return null;
}
Function (anonymous_232)
✗ Was not called
}).fail(function (err) {···
if (err instanceof DepsError) {
err.message += ' in file "' + file.fullname + '"';
}
throw err;
});
}).fail(function (err) {
Branch IfStatement
✗ Positive was not executed (if)
if (err instanceof DepsError) {···
err.message += ' in file "' + file.fullname + '"';
}
✗ Negative was not executed (else)
}···
throw err;
if (err instanceof DepsError) {
err.message += ' in file "' + file.fullname + '"';
}
throw err;
});
}
Function removeFromDeps
✗ Was not called
function removeFromDeps(decl, index, list) {···
if (index[decl.key]) {
for (var i = 0, l = list.length; i < l; i++) {
if (list[i].key === decl.key) {
return list.splice(i, 1);
}
}
} else {
index[decl.key] = true;
}
return null;
}
function removeFromDeps(decl, index, list) {
Branch IfStatement
✗ Positive was not executed (if)
if (index[decl.key]) {···
for (var i = 0, l = list.length; i < l; i++) {
if (list[i].key === decl.key) {
return list.splice(i, 1);
}
}
} else {
✗ Negative was not executed (else)
} else {···
index[decl.key] = true;
}
if (index[decl.key]) {
for (var i = 0, l = list.length; i < l; i++) {
Branch IfStatement
✗ Positive was not executed (if)
if (list[i].key === decl.key) {···
return list.splice(i, 1);
}
✗ Negative was not executed (else)
}···
}
if (list[i].key === decl.key) {
return list.splice(i, 1);
}
}
} else {
index[decl.key] = true;
}
return null;
}
var result = { mustDeps: mustDeps, shouldDeps: shouldDeps };
Branch IfStatement
✗ Positive was not executed (if)
if (files.length > 0) {···
return keepWorking(files.shift()).then(function () {
return result;
});
} else {
✗ Negative was not executed (else)
} else {···
return Vow.fulfill(result);
}
if (files.length > 0) {
Function (anonymous_234)
✗ Was not called
return keepWorking(files.shift()).then(function () {···
return result;
});
return keepWorking(files.shift()).then(function () {
return result;
});
} else {
return Vow.fulfill(result);
}
},
/**
* Добавляет декларацию блока в резолвер.
* @param {String} blockName
* @param {String} modName
* @param {String} modVal
* @returns {Promise}
*/
Function (anonymous_235)
✗ Was not called
addBlock: function (blockName, modName, modVal) {···
if (modName) {
this.addDecl({
name: blockName,
modName: modName,
modVal: modVal
});
} else {
this.addDecl({
name: blockName
});
}
},
addBlock: function (blockName, modName, modVal) {
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
this.addDecl({
name: blockName,
modName: modName,
modVal: modVal
});
} else {
✗ Negative was not executed (else)
} else {···
this.addDecl({
name: blockName
});
}
if (modName) {
this.addDecl({
name: blockName,
modName: modName,
modVal: modVal
});
} else {
this.addDecl({
name: blockName
});
}
},
/**
* Добавляет декларацию элемента в резолвер.
* @param {String} blockName
* @param {String} elemName
* @param {String} modName
* @param {String} modVal
* @returns {Promise}
*/
Function (anonymous_236)
✗ Was not called
addElem: function (blockName, elemName, modName, modVal) {···
if (modName) {
return this.addDecl({
name: blockName,
elem: elemName,
modName: modName,
modVal: modVal
});
} else {
return this.addDecl({
name: blockName,
elem: elemName
});
}
},
addElem: function (blockName, elemName, modName, modVal) {
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
return this.addDecl({
name: blockName,
elem: elemName,
modName: modName,
modVal: modVal
});
} else {
✗ Negative was not executed (else)
} else {···
return this.addDecl({
name: blockName,
elem: elemName
});
}
if (modName) {
return this.addDecl({
name: blockName,
elem: elemName,
modName: modName,
modVal: modVal
});
} else {
return this.addDecl({
name: blockName,
elem: elemName
});
}
},
/**
* Добавляет декларацию в резолвер.
* @param {Object} decl
* @returns {Promise}
*/
Function (anonymous_237)
✗ Was not called
addDecl: function (decl) {···
var _this = this;
var key = declKey(decl);
if (this.declarationIndex[key]) {
return null;
}
this.declarations.push(decl);
this.declarationIndex[key] = decl;
return this.getDeps(decl).then(function (deps) {
decl.key = key;
decl.deps = {};
decl.depCount = 0;
return _this.addDecls(deps.mustDeps, function (dep) {
decl.deps[dep.key] = true;
decl.depCount++;
}).then(function () {
return _this.addDecls(deps.shouldDeps);
});
});
},
addDecl: function (decl) {
var _this = this;
var key = declKey(decl);
Branch IfStatement
✗ Positive was not executed (if)
if (this.declarationIndex[key]) {···
return null;
}
✗ Negative was not executed (else)
}···
this.declarations.push(decl);
if (this.declarationIndex[key]) {
return null;
}
this.declarations.push(decl);
this.declarationIndex[key] = decl;
Function (anonymous_238)
✗ Was not called
return this.getDeps(decl).then(function (deps) {···
decl.key = key;
decl.deps = {};
decl.depCount = 0;
return _this.addDecls(deps.mustDeps, function (dep) {
decl.deps[dep.key] = true;
decl.depCount++;
}).then(function () {
return _this.addDecls(deps.shouldDeps);
});
});
return this.getDeps(decl).then(function (deps) {
decl.key = key;
decl.deps = {};
decl.depCount = 0;
Function (anonymous_239)
✗ Was not called
return _this.addDecls(deps.mustDeps, function (dep) {···
decl.deps[dep.key] = true;
decl.depCount++;
}).then(function () {
return _this.addDecls(deps.mustDeps, function (dep) {
decl.deps[dep.key] = true;
decl.depCount++;
Function (anonymous_240)
✗ Was not called
}).then(function () {···
return _this.addDecls(deps.shouldDeps);
});
}).then(function () {
return _this.addDecls(deps.shouldDeps);
});
});
},
/**
* Добавляет набор деклараций.
* @param {Array} decls
* @returns {Promise}
* @param {Function} [preCallback]
*/
Function (anonymous_241)
✗ Was not called
addDecls: function (decls, preCallback) {···
var promise = Vow.fulfill();
var _this = this;
decls.forEach(function (decl) {
promise = promise.then(function () {
if (preCallback) {
preCallback(decl);
}
return _this.addDecl(decl);
});
});
return promise;
},
addDecls: function (decls, preCallback) {
var promise = Vow.fulfill();
var _this = this;
Function (anonymous_242)
✗ Was not called
decls.forEach(function (decl) {···
promise = promise.then(function () {
if (preCallback) {
preCallback(decl);
}
return _this.addDecl(decl);
});
});
decls.forEach(function (decl) {
Function (anonymous_243)
✗ Was not called
promise = promise.then(function () {···
if (preCallback) {
preCallback(decl);
}
return _this.addDecl(decl);
});
promise = promise.then(function () {
Branch IfStatement
✗ Positive was not executed (if)
if (preCallback) {···
preCallback(decl);
}
✗ Negative was not executed (else)
}···
return _this.addDecl(decl);
if (preCallback) {
preCallback(decl);
}
return _this.addDecl(decl);
});
});
return promise;
},
/**
* Упорядочивает deps'ы, возвращает в порядке зависимостей.
* @returns {Array}
*/
Function (anonymous_244)
✗ Was not called
resolve: function () {···
var items = this.declarations.slice(0);
var result = [];
var hasChanges = true;
var newItems;
while (hasChanges) {
newItems = [];
hasChanges = false;
for (var i = 0, l = items.length; i < l; i++) {
var decl = items[i];
if (decl.depCount === 0) {
hasChanges = true;
for (var j = 0; j < l; j++) {
var subDecl = items[j];
if (subDecl.deps[decl.key]) {
delete subDecl.deps[decl.key];
subDecl.depCount--;
}
}
var item = {
block: decl.name
};
if (decl.elem) {
item.elem = decl.elem;
}
if (decl.modName) {
item.mod = decl.modName;
if (decl.hasOwnProperty('modVal')) {
item.val = decl.modVal;
}
}
result.push(item);
} else {
newItems.push(decl);
}
}
items = newItems;
}
if (items.length) {
var errorMessage = items.map(function (item) {
return item.key + ' <- ' + Object.keys(item.deps).join(', ');
});
throw Error('Unresolved deps: \n' + errorMessage.join('\n'));
}
return result;
}
resolve: function () {
var items = this.declarations.slice(0);
var result = [];
var hasChanges = true;
var newItems;
while (hasChanges) {
newItems = [];
hasChanges = false;
for (var i = 0, l = items.length; i < l; i++) {
var decl = items[i];
Branch IfStatement
✗ Positive was not executed (if)
if (decl.depCount === 0) {···
hasChanges = true;
for (var j = 0; j < l; j++) {
var subDecl = items[j];
if (subDecl.deps[decl.key]) {
delete subDecl.deps[decl.key];
subDecl.depCount--;
}
}
var item = {
block: decl.name
};
if (decl.elem) {
item.elem = decl.elem;
}
if (decl.modName) {
item.mod = decl.modName;
if (decl.hasOwnProperty('modVal')) {
item.val = decl.modVal;
}
}
result.push(item);
} else {
✗ Negative was not executed (else)
} else {···
newItems.push(decl);
}
if (decl.depCount === 0) {
hasChanges = true;
for (var j = 0; j < l; j++) {
var subDecl = items[j];
Branch IfStatement
✗ Positive was not executed (if)
if (subDecl.deps[decl.key]) {···
delete subDecl.deps[decl.key];
subDecl.depCount--;
}
✗ Negative was not executed (else)
}···
}
if (subDecl.deps[decl.key]) {
delete subDecl.deps[decl.key];
subDecl.depCount--;
}
}
var item = {
block: decl.name
};
Branch IfStatement
✗ Positive was not executed (if)
if (decl.elem) {···
item.elem = decl.elem;
}
✗ Negative was not executed (else)
}···
if (decl.modName) {
if (decl.elem) {
item.elem = decl.elem;
}
Branch IfStatement
✗ Positive was not executed (if)
if (decl.modName) {···
item.mod = decl.modName;
if (decl.hasOwnProperty('modVal')) {
item.val = decl.modVal;
}
}
✗ Negative was not executed (else)
}···
result.push(item);
if (decl.modName) {
item.mod = decl.modName;
Branch IfStatement
✗ Positive was not executed (if)
if (decl.hasOwnProperty('modVal')) {···
item.val = decl.modVal;
}
✗ Negative was not executed (else)
}···
}
if (decl.hasOwnProperty('modVal')) {
item.val = decl.modVal;
}
}
result.push(item);
} else {
newItems.push(decl);
}
}
items = newItems;
}
Branch IfStatement
✗ Positive was not executed (if)
if (items.length) {···
var errorMessage = items.map(function (item) {
return item.key + ' <- ' + Object.keys(item.deps).join(', ');
});
throw Error('Unresolved deps: \n' + errorMessage.join('\n'));
}
✗ Negative was not executed (else)
}···
return result;
if (items.length) {
Function (anonymous_245)
✗ Was not called
var errorMessage = items.map(function (item) {···
return item.key + ' <- ' + Object.keys(item.deps).join(', ');
});
var errorMessage = items.map(function (item) {
return item.key + ' <- ' + Object.keys(item.deps).join(', ');
});
throw Error('Unresolved deps: \n' + errorMessage.join('\n'));
}
return result;
}
});
Function declKey
✗ Was not called
function declKey(decl) {···
return decl.name + (decl.elem ? '__' + decl.elem : '') +
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
}
function declKey(decl) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return decl.name + (decl.elem ? '__' + decl.elem : '') +
✗ Negative was not returned (: ...)
return decl.name + (decl.elem ? '__' + decl.elem : '') +
return decl.name + (decl.elem ? '__' + decl.elem : '') +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
✗ Negative was not returned (: ...)
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
✗ Negative was not returned (: ...)
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
(decl.modName ? '_' + decl.modName + (decl.modVal ? '_' + decl.modVal : '') : '');
}
borschik-preprocessor.js
/**
* BorschikPreprocessor
* ====================
*/
var inherit = require('inherit');
var Vow = require('vow');
var borschik = require('borschik');
/**
* BorschikPreprocessor — препроцессор js/css-файлов на основе Борщика.
* @name BorschikPreprocessor
*
* @deprecated
*/
module.exports = inherit({
/**
* Осуществляет обработку файла Борщиком.
* @param {String} sourceFilename Исходный файл.
* @param {String} destFilename Результирующий файл.
* @param {Boolean} freeze Осуществлять ли фризинг.
* @param {Boolean} minimize Осуществлять ли минимизацию.
* @param {String} [tech]
* @returns {*}
*/
Function (anonymous_247)
✗ Was not called
preprocessFile: function (sourceFilename, destFilename, freeze, minimize, tech) {···
var opts = {
input: sourceFilename,
output: destFilename,
freeze: freeze,
minimize: minimize
};
if (tech) {
opts.tech = tech;
}
return Vow.when(borschik.api(opts));
}
preprocessFile: function (sourceFilename, destFilename, freeze, minimize, tech) {
var opts = {
input: sourceFilename,
output: destFilename,
freeze: freeze,
minimize: minimize
};
Branch IfStatement
✗ Positive was not executed (if)
if (tech) {···
opts.tech = tech;
}
✗ Negative was not executed (else)
}···
return Vow.when(borschik.api(opts));
if (tech) {
opts.tech = tech;
}
return Vow.when(borschik.api(opts));
}
});
css-preprocessor.js
/**
* CssPreprocessor
* ===============
*/
var inherit = require('inherit');
var path = require('path');
var Vow = require('vow');
var vowFs = require('../fs/async-fs');
/**
* CssPreprocessor — класс для препроцессинга CSS. Заменяет import'ы на содержимое CSS-файлов,
* изменяет url'ы картинок.
* @name CssPreprocessor
*/
module.exports = inherit({
/**
* Конструктор.
*/
Function (anonymous_248)
✓ Was called
__constructor: function () {···
this._buildCssRelativeUrl = function (url) {
return url;
};
},
__constructor: function () {
Function (anonymous_249)
✗ Was not called
this._buildCssRelativeUrl = function (url) {···
return url;
};
this._buildCssRelativeUrl = function (url) {
return url;
};
},
/**
* Устанавливает функцию для построения относительных путей.
* @var {Function} builder
*/
Function (anonymous_250)
✓ Was called
setCssRelativeUrlBuilder: function (builder) {···
this._buildCssRelativeUrl = builder;
},
setCssRelativeUrlBuilder: function (builder) {
this._buildCssRelativeUrl = builder;
},
/**
* Запускает препроцессинг.
* @param {String} data CSS для препроцессинга.
* @param {String} filename Имя результирующего файла.
*/
Function (anonymous_251)
✓ Was called
preprocess: function (data, filename) {···
return this._processIncludes(this._processUrls(data, filename), filename);
},
preprocess: function (data, filename) {
return this._processIncludes(this._processUrls(data, filename), filename);
},
/**
* @returns {Promise}
*/
Function (anonymous_252)
✗ Was not called
preprocessIncludes: function (data, filename) {···
return this._processIncludes(data, filename);
},
preprocessIncludes: function (data, filename) {
return this._processIncludes(data, filename);
},
Function (anonymous_253)
✓ Was called
_processUrls: function (data, filename) {···
var _this = this;
return data
.replace(/(?:@import\s*)?url\(('[^']+'|"[^"]+"|[^'")]+)\)/g, function (s, url) {
if (s.indexOf('@import') === 0) {
return s;
}
// Тип кавычки
var q = '';
var firstChar = url.charAt(0);
if (firstChar === '\'' || firstChar === '"') {
url = url.substr(1, url.length - 2);
q = firstChar;
}
return 'url(' + q + _this._resolveCssUrl(url, filename) + q + ')';
}).replace(/src=[']?([^',\)]+)[']?/g, function (s, url) {
return 'src=\'' + _this._resolveCssUrl(url, filename) + '\'';
});
},
_processUrls: function (data, filename) {
var _this = this;
return data
Function (anonymous_254)
✓ Was called
.replace(/(?:@import\s*)?url\(('[^']+'|"[^"]+"|[^'")]+)\)/g, function (s, url) {···
if (s.indexOf('@import') === 0) {
return s;
}
// Тип кавычки
var q = '';
var firstChar = url.charAt(0);
if (firstChar === '\'' || firstChar === '"') {
url = url.substr(1, url.length - 2);
q = firstChar;
}
return 'url(' + q + _this._resolveCssUrl(url, filename) + q + ')';
}).replace(/src=[']?([^',\)]+)[']?/g, function (s, url) {
.replace(/(?:@import\s*)?url\(('[^']+'|"[^"]+"|[^'")]+)\)/g, function (s, url) {
Branch IfStatement
✗ Positive was not executed (if)
if (s.indexOf('@import') === 0) {···
return s;
}
✓ Negative was executed (else)
}···
// Тип кавычки
if (s.indexOf('@import') === 0) {
return s;
}
// Тип кавычки
var q = '';
var firstChar = url.charAt(0);
Branch IfStatement
✓ Positive was executed (if)
if (firstChar === '\'' || firstChar === '"') {···
url = url.substr(1, url.length - 2);
q = firstChar;
}
✓ Negative was executed (else)
}···
return 'url(' + q + _this._resolveCssUrl(url, filename) + q + ')';
Branch LogicalExpression
✓ Was returned
if (firstChar === '\'' || firstChar === '"') {
✓ Was returned
if (firstChar === '\'' || firstChar === '"') {
if (firstChar === '\'' || firstChar === '"') {
url = url.substr(1, url.length - 2);
q = firstChar;
}
return 'url(' + q + _this._resolveCssUrl(url, filename) + q + ')';
Function (anonymous_255)
✗ Was not called
}).replace(/src=[']?([^',\)]+)[']?/g, function (s, url) {···
return 'src=\'' + _this._resolveCssUrl(url, filename) + '\'';
});
}).replace(/src=[']?([^',\)]+)[']?/g, function (s, url) {
return 'src=\'' + _this._resolveCssUrl(url, filename) + '\'';
});
},
Function (anonymous_256)
✓ Was called
_resolveCssUrl: function (url, filename) {···
if (url.substr(0, 5) === 'data:' ||
url.substr(0, 2) === '//' ||
~url.indexOf('http://') ||
~url.indexOf('https://')
) {
return url;
} else {
return this._buildCssRelativeUrl(url, filename);
}
},
_resolveCssUrl: function (url, filename) {
Branch IfStatement
✓ Positive was executed (if)
) {···
return url;
} else {
✓ Negative was executed (else)
} else {···
return this._buildCssRelativeUrl(url, filename);
}
Branch LogicalExpression
✓ Was returned
~url.indexOf('https://')
✓ Was returned
if (url.substr(0, 5) === 'data:' ||···
url.substr(0, 2) === '//' ||
~url.indexOf('http://') ||
Branch LogicalExpression
✓ Was returned
~url.indexOf('http://') ||
✓ Was returned
if (url.substr(0, 5) === 'data:' ||···
url.substr(0, 2) === '//' ||
Branch LogicalExpression
✓ Was returned
url.substr(0, 2) === '//' ||
✓ Was returned
if (url.substr(0, 5) === 'data:' ||
if (url.substr(0, 5) === 'data:' ||
url.substr(0, 2) === '//' ||
~url.indexOf('http://') ||
~url.indexOf('https://')
) {
return url;
} else {
return this._buildCssRelativeUrl(url, filename);
}
},
Function (anonymous_257)
✓ Was called
_processIncludes: function (data, filename) {···
var _this = this;
var filesToLoad = {};
var regex = /@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g;
var match;
var loadPromises = [];
function addLoadPromise (url) {
var includedFilename = path.resolve(path.dirname(filename), url);
loadPromises.push(vowFs.read(includedFilename, 'utf8').then(function (data) {
return _this.preprocess(data, includedFilename).then(function (preprocessedData) {
filesToLoad[url] = preprocessedData;
});
}));
}
while (!!(match = regex.exec(data))) {
addLoadPromise(match[1]);
}
return Vow.all(loadPromises).then(function () {
return data.replace(/@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g, function (s, url) {
var pre = '/* ' + url + ': begin */ /**/\n';
var post = '\n/* ' + url + ': end */ /**/\n';
return pre + ' ' + filesToLoad[url].replace(/\n/g, '\n ') + post;
});
});
}
_processIncludes: function (data, filename) {
var _this = this;
var filesToLoad = {};
var regex = /@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g;
var match;
var loadPromises = [];
Function addLoadPromise
✗ Was not called
function addLoadPromise (url) {···
var includedFilename = path.resolve(path.dirname(filename), url);
loadPromises.push(vowFs.read(includedFilename, 'utf8').then(function (data) {
return _this.preprocess(data, includedFilename).then(function (preprocessedData) {
filesToLoad[url] = preprocessedData;
});
}));
}
function addLoadPromise (url) {
var includedFilename = path.resolve(path.dirname(filename), url);
Function (anonymous_259)
✗ Was not called
loadPromises.push(vowFs.read(includedFilename, 'utf8').then(function (data) {···
return _this.preprocess(data, includedFilename).then(function (preprocessedData) {
filesToLoad[url] = preprocessedData;
});
}));
loadPromises.push(vowFs.read(includedFilename, 'utf8').then(function (data) {
Function (anonymous_260)
✗ Was not called
return _this.preprocess(data, includedFilename).then(function (preprocessedData) {···
filesToLoad[url] = preprocessedData;
});
return _this.preprocess(data, includedFilename).then(function (preprocessedData) {
filesToLoad[url] = preprocessedData;
});
}));
}
while (!!(match = regex.exec(data))) {
addLoadPromise(match[1]);
}
Function (anonymous_261)
✓ Was called
return Vow.all(loadPromises).then(function () {···
return data.replace(/@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g, function (s, url) {
var pre = '/* ' + url + ': begin */ /**/\n';
var post = '\n/* ' + url + ': end */ /**/\n';
return pre + ' ' + filesToLoad[url].replace(/\n/g, '\n ') + post;
});
});
return Vow.all(loadPromises).then(function () {
Function (anonymous_262)
✗ Was not called
return data.replace(/@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g, function (s, url) {···
var pre = '/* ' + url + ': begin */ /**/\n';
var post = '\n/* ' + url + ': end */ /**/\n';
return pre + ' ' + filesToLoad[url].replace(/\n/g, '\n ') + post;
});
return data.replace(/@import\s*(?:url\()?["']?([^"'\)]+)["']?(?:\))?\s*;/g, function (s, url) {
var pre = '/* ' + url + ': begin */ /**/\n';
var post = '\n/* ' + url + ': end */ /**/\n';
return pre + ' ' + filesToLoad[url].replace(/\n/g, '\n ') + post;
});
});
}
});
chunks.js
/**
* chunks
* ======
*
* Базовая технология для chunks-технологий.
* Помогает реализовывать технологии для bembundle-сборок.
*
* @deprecated
*/
var Vow = require('vow');
var vowFs = require('../fs/async-fs');
var crypto = require('crypto');
module.exports = require('../build-flow').create()
.name('chunks')
.deprecated('enb')
.useFileList('chunk')
.target('target', 'chunks.js')
Function (anonymous_263)
✗ Was not called
.builder(function (chunkFiles) {···
return Vow.when(this.getChunks(chunkFiles)).then(function (items) {
return 'module.exports = ' + JSON.stringify(items) + ';';
});
})
.builder(function (chunkFiles) {
Function (anonymous_264)
✗ Was not called
return Vow.when(this.getChunks(chunkFiles)).then(function (items) {···
return 'module.exports = ' + JSON.stringify(items) + ';';
});
return Vow.when(this.getChunks(chunkFiles)).then(function (items) {
return 'module.exports = ' + JSON.stringify(items) + ';';
});
})
.methods({
Function (anonymous_265)
✗ Was not called
getChunks: function (sourceFiles) {···
var _this = this;
return Vow.all(sourceFiles.map(function (sourceFile) {
return vowFs.read(sourceFile.fullname, 'utf8').then(function (data) {
return _this.processChunk(sourceFile.fullname, data);
});
}));
},
getChunks: function (sourceFiles) {
var _this = this;
Function (anonymous_266)
✗ Was not called
return Vow.all(sourceFiles.map(function (sourceFile) {···
return vowFs.read(sourceFile.fullname, 'utf8').then(function (data) {
return _this.processChunk(sourceFile.fullname, data);
});
}));
return Vow.all(sourceFiles.map(function (sourceFile) {
Function (anonymous_267)
✗ Was not called
return vowFs.read(sourceFile.fullname, 'utf8').then(function (data) {···
return _this.processChunk(sourceFile.fullname, data);
});
return vowFs.read(sourceFile.fullname, 'utf8').then(function (data) {
return _this.processChunk(sourceFile.fullname, data);
});
}));
},
Function (anonymous_268)
✗ Was not called
processChunk: function (filename, data) {···
return Vow.when(this.processChunkData(filename, data)).then(function (data) {
var hash = crypto.createHash('sha1');
hash.update(data);
return {
fullname: filename,
data: data,
hash: hash.digest('base64')
};
});
},
processChunk: function (filename, data) {
Function (anonymous_269)
✗ Was not called
return Vow.when(this.processChunkData(filename, data)).then(function (data) {···
var hash = crypto.createHash('sha1');
hash.update(data);
return {
fullname: filename,
data: data,
hash: hash.digest('base64')
};
});
return Vow.when(this.processChunkData(filename, data)).then(function (data) {
var hash = crypto.createHash('sha1');
hash.update(data);
return {
fullname: filename,
data: data,
hash: hash.digest('base64')
};
});
},
Function (anonymous_270)
✗ Was not called
processChunkData: function (filename, data) {···
return data;
}
processChunkData: function (filename, data) {
return data;
}
})
.createTech();
level.js
/**
* Level
* =====
*/
var inherit = require('inherit');
var fs = require('fs');
var Vow = require('vow');
var LevelBuilder = require('./level-builder');
// TODO: Сделать 1-в-1 асинхронный аналог (с точно таким же порядком файлов на выходе).
/**
* Level — объектная модель уровня переопределения.
* @name Level
*/
module.exports = inherit({
/**
* Конструктор.
* @param {String} path Путь к уровню переопределения.
* @param {Function} [schemeBuilder]
*/
Function (anonymous_271)
✗ Was not called
__constructor: function (path, schemeBuilder) {···
this._path = path;
this.blocks = {};
this._loadPromise = null;
this._schemeBuilder = schemeBuilder;
},
__constructor: function (path, schemeBuilder) {
this._path = path;
this.blocks = {};
this._loadPromise = null;
this._schemeBuilder = schemeBuilder;
},
/**
* Загружает из кэша.
*/
Function (anonymous_272)
✗ Was not called
loadFromCache: function (data) {···
this.blocks = data;
this._loadPromise = Vow.fulfill(this);
},
loadFromCache: function (data) {
this.blocks = data;
this._loadPromise = Vow.fulfill(this);
},
/**
* Возвращает структуру блоков.
* @returns {Object}
*/
Function (anonymous_273)
✗ Was not called
getBlocks: function () {···
return this.blocks;
},
getBlocks: function () {
return this.blocks;
},
/**
* Проверяет наличие блока с указанным именем.
* @param blockName
* @returns {Boolean}
*/
Function (anonymous_274)
✗ Was not called
hasBlock: function (blockName) {···
return this.blocks[blockName];
},
hasBlock: function (blockName) {
return this.blocks[blockName];
},
/**
* Возвращает абсолютный путь к уровню переопределения.
* @returns {String}
*/
Function (anonymous_275)
✗ Was not called
getPath: function () {···
return this._path;
},
getPath: function () {
return this._path;
},
/**
* Обрабатывает файл, добавляет его в необходимое место в структуре.
* @param {String} filename
* @param {Object} stat node.js Stat
* @param {String} parentElementName
* @param {String} elementName
* @param {String} modName
* @private
*/
Function (anonymous_276)
✗ Was not called
_processFile: function (filename, stat, parentElementName, elementName, modName) {···
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') +
elementName + (modName ? '_' + modName : '');
var baseName = filename.split('/').slice(-1)[0];
var baseNameParts = baseName.split('.');
var baseNameWithoutExt = stat.isDirectory() ?
baseNameParts.slice(0, baseNameParts.length - 1).join('.') :
baseNameParts[0];
var rl = requiredBaseNameWithoutExt.length;
var modVal;
var processFile = baseNameWithoutExt.indexOf(requiredBaseNameWithoutExt) === 0 && (
modName ?
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
baseNameWithoutExt === requiredBaseNameWithoutExt
);
if (!processFile && !modName && !parentElementName) {
var baseNameModParts = baseNameWithoutExt.split('_');
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {
processFile = true;
modName = 'view';
modVal = baseNameModParts[1];
}
}
if (processFile) {
var suffix = stat.isDirectory() ? baseNameParts.pop() : baseNameParts.slice(1).join('.');
var fileInfo = {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
if (fileInfo.isDirectory) {
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
var blockName = parentElementName || elementName;
var block = this.blocks[blockName] || (this.blocks[blockName] = {
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
var destElement;
if (parentElementName) {
destElement = block.elements[elementName] || (block.elements[elementName] = {
name: elementName,
files: [],
dirs: [],
mods: {}
});
} else {
destElement = block;
}
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
if (modName) {
if (!modVal) {
if (rl !== baseNameWithoutExt.length) {
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
modVal = '';
}
}
if (modName === 'view' && modVal === 'view') {
modVal = '';
}
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
destElement[collectionKey].push(fileInfo);
}
}
},
_processFile: function (filename, stat, parentElementName, elementName, modName) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') +
✗ Negative was not returned (: ...)
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') +
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
elementName + (modName ? '_' + modName : '');
✗ Negative was not returned (: ...)
elementName + (modName ? '_' + modName : '');
elementName + (modName ? '_' + modName : '');
var baseName = filename.split('/').slice(-1)[0];
var baseNameParts = baseName.split('.');
Branch ConditionalExpression
✗ Positive was not returned (? ...)
baseNameParts.slice(0, baseNameParts.length - 1).join('.') :
✗ Negative was not returned (: ...)
baseNameParts[0];
var baseNameWithoutExt = stat.isDirectory() ?
baseNameParts.slice(0, baseNameParts.length - 1).join('.') :
baseNameParts[0];
var rl = requiredBaseNameWithoutExt.length;
var modVal;
Branch LogicalExpression
✗ Was not returned
modName ?···
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
baseNameWithoutExt === requiredBaseNameWithoutExt
✗ Was not returned
var processFile = baseNameWithoutExt.indexOf(requiredBaseNameWithoutExt) === 0 && (
var processFile = baseNameWithoutExt.indexOf(requiredBaseNameWithoutExt) === 0 && (
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
✗ Negative was not returned (: ...)
baseNameWithoutExt === requiredBaseNameWithoutExt
modName ?
Branch LogicalExpression
✗ Was not returned
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
✗ Was not returned
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
(rl === baseNameWithoutExt.length) || baseNameWithoutExt.charAt(rl) === '_' :
baseNameWithoutExt === requiredBaseNameWithoutExt
);
Branch IfStatement
✗ Positive was not executed (if)
if (!processFile && !modName && !parentElementName) {···
var baseNameModParts = baseNameWithoutExt.split('_');
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {
processFile = true;
modName = 'view';
modVal = baseNameModParts[1];
}
}
✗ Negative was not executed (else)
}···
if (processFile) {
Branch LogicalExpression
✗ Was not returned
if (!processFile && !modName && !parentElementName) {
✗ Was not returned
if (!processFile && !modName && !parentElementName) {
Branch LogicalExpression
✗ Was not returned
if (!processFile && !modName && !parentElementName) {
✗ Was not returned
if (!processFile && !modName && !parentElementName) {
if (!processFile && !modName && !parentElementName) {
var baseNameModParts = baseNameWithoutExt.split('_');
Branch IfStatement
✗ Positive was not executed (if)
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {···
processFile = true;
modName = 'view';
modVal = baseNameModParts[1];
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {
✗ Was not returned
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {
if (baseNameModParts.length === 2 && baseNameModParts[0] === requiredBaseNameWithoutExt) {
processFile = true;
modName = 'view';
modVal = baseNameModParts[1];
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (processFile) {···
var suffix = stat.isDirectory() ? baseNameParts.pop() : baseNameParts.slice(1).join('.');
var fileInfo = {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
if (fileInfo.isDirectory) {
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
var blockName = parentElementName || elementName;
var block = this.blocks[blockName] || (this.blocks[blockName] = {
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
var destElement;
if (parentElementName) {
destElement = block.elements[elementName] || (block.elements[elementName] = {
name: elementName,
files: [],
dirs: [],
mods: {}
});
} else {
destElement = block;
}
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
if (modName) {
if (!modVal) {
if (rl !== baseNameWithoutExt.length) {
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
modVal = '';
}
}
if (modName === 'view' && modVal === 'view') {
modVal = '';
}
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
destElement[collectionKey].push(fileInfo);
}
}
✗ Negative was not executed (else)
}···
},
if (processFile) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var suffix = stat.isDirectory() ? baseNameParts.pop() : baseNameParts.slice(1).join('.');
✗ Negative was not returned (: ...)
var suffix = stat.isDirectory() ? baseNameParts.pop() : baseNameParts.slice(1).join('.');
var suffix = stat.isDirectory() ? baseNameParts.pop() : baseNameParts.slice(1).join('.');
var fileInfo = {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
Branch IfStatement
✗ Positive was not executed (if)
if (fileInfo.isDirectory) {···
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
✗ Negative was not executed (else)
}···
var blockName = parentElementName || elementName;
if (fileInfo.isDirectory) {
Function (anonymous_277)
✗ Was not called
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {···
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
Branch LogicalExpression
✗ Was not returned
var blockName = parentElementName || elementName;
✗ Was not returned
var blockName = parentElementName || elementName;
var blockName = parentElementName || elementName;
Branch LogicalExpression
✗ Was not returned
var block = this.blocks[blockName] || (this.blocks[blockName] = {···
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
✗ Was not returned
var block = this.blocks[blockName] || (this.blocks[blockName] = {
var block = this.blocks[blockName] || (this.blocks[blockName] = {
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
var destElement;
Branch IfStatement
✗ Positive was not executed (if)
if (parentElementName) {···
destElement = block.elements[elementName] || (block.elements[elementName] = {
name: elementName,
files: [],
dirs: [],
mods: {}
});
} else {
✗ Negative was not executed (else)
} else {···
destElement = block;
}
if (parentElementName) {
Branch LogicalExpression
✗ Was not returned
destElement = block.elements[elementName] || (block.elements[elementName] = {···
name: elementName,
files: [],
dirs: [],
mods: {}
});
✗ Was not returned
destElement = block.elements[elementName] || (block.elements[elementName] = {
destElement = block.elements[elementName] || (block.elements[elementName] = {
name: elementName,
files: [],
dirs: [],
mods: {}
});
} else {
destElement = block;
}
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
✗ Negative was not returned (: ...)
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
if (!modVal) {
if (rl !== baseNameWithoutExt.length) {
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
modVal = '';
}
}
if (modName === 'view' && modVal === 'view') {
modVal = '';
}
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
✗ Negative was not executed (else)
} else {···
destElement[collectionKey].push(fileInfo);
}
if (modName) {
Branch IfStatement
✗ Positive was not executed (if)
if (!modVal) {···
if (rl !== baseNameWithoutExt.length) {
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
modVal = '';
}
}
✗ Negative was not executed (else)
}···
if (modName === 'view' && modVal === 'view') {
if (!modVal) {
Branch IfStatement
✗ Positive was not executed (if)
if (rl !== baseNameWithoutExt.length) {···
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
✗ Negative was not executed (else)
} else {···
modVal = '';
}
if (rl !== baseNameWithoutExt.length) {
modVal = baseNameWithoutExt.substr(rl + 1);
} else {
modVal = '';
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (modName === 'view' && modVal === 'view') {···
modVal = '';
}
✗ Negative was not executed (else)
}···
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
Branch LogicalExpression
✗ Was not returned
if (modName === 'view' && modVal === 'view') {
✗ Was not returned
if (modName === 'view' && modVal === 'view') {
if (modName === 'view' && modVal === 'view') {
modVal = '';
}
Branch LogicalExpression
✗ Was not returned
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
✗ Was not returned
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
Branch LogicalExpression
✗ Was not returned
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
✗ Was not returned
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
destElement[collectionKey].push(fileInfo);
}
}
},
/**
* Загружает файлы и директории в папке модификатора.
* @param {String} parentElementName
* @param {String} elementName
* @param {String} modName
* @param {String} modDirPath
* @private
*/
Function (anonymous_278)
✗ Was not called
_loadMod: function (parentElementName, elementName, modName, modDirPath) {···
var _this = this;
filterFiles(fs.readdirSync(modDirPath)).forEach(function (filename) {
var fullname = modDirPath + '/' + filename;
var stat = fs.statSync(fullname);
_this._processFile(fullname, stat, parentElementName, elementName, modName);
});
},
_loadMod: function (parentElementName, elementName, modName, modDirPath) {
var _this = this;
Function (anonymous_279)
✗ Was not called
filterFiles(fs.readdirSync(modDirPath)).forEach(function (filename) {···
var fullname = modDirPath + '/' + filename;
var stat = fs.statSync(fullname);
_this._processFile(fullname, stat, parentElementName, elementName, modName);
});
filterFiles(fs.readdirSync(modDirPath)).forEach(function (filename) {
var fullname = modDirPath + '/' + filename;
var stat = fs.statSync(fullname);
_this._processFile(fullname, stat, parentElementName, elementName, modName);
});
},
/**
* Загружает файлы и директории в папке элемента или блока (если не указан parentElementName).
* @param {String} parentElementName
* @param {String} elementName
* @param {String} elementDirPath
* @param {String} containsElements
* @private
*/
Function (anonymous_280)
✗ Was not called
_loadElement: function (parentElementName, elementName, elementDirPath, containsElements) {···
var _this = this;
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') + elementName;
filterFiles(fs.readdirSync(elementDirPath)).forEach(function (filename) {
var fullname = elementDirPath + '/' + filename;
var stat = fs.statSync(fullname);
if (stat.isDirectory()) {
if (containsElements && filename.substr(0, 2) === '__') {
_this._loadElement(elementName, filename.substr(2), fullname, false);
} else if (filename.charAt(0) === '_') {
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
} else if (stat.isFile()) {
_this._processFile(fullname, stat, parentElementName, elementName);
}
});
},
_loadElement: function (parentElementName, elementName, elementDirPath, containsElements) {
var _this = this;
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') + elementName;
✗ Negative was not returned (: ...)
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') + elementName;
var requiredBaseNameWithoutExt = (parentElementName ? parentElementName + '__' : '') + elementName;
Function (anonymous_281)
✗ Was not called
filterFiles(fs.readdirSync(elementDirPath)).forEach(function (filename) {···
var fullname = elementDirPath + '/' + filename;
var stat = fs.statSync(fullname);
if (stat.isDirectory()) {
if (containsElements && filename.substr(0, 2) === '__') {
_this._loadElement(elementName, filename.substr(2), fullname, false);
} else if (filename.charAt(0) === '_') {
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
} else if (stat.isFile()) {
_this._processFile(fullname, stat, parentElementName, elementName);
}
});
filterFiles(fs.readdirSync(elementDirPath)).forEach(function (filename) {
var fullname = elementDirPath + '/' + filename;
var stat = fs.statSync(fullname);
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isDirectory()) {···
if (containsElements && filename.substr(0, 2) === '__') {
_this._loadElement(elementName, filename.substr(2), fullname, false);
} else if (filename.charAt(0) === '_') {
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
} else if (stat.isFile()) {
✗ Negative was not executed (else)
} else if (stat.isFile()) {···
_this._processFile(fullname, stat, parentElementName, elementName);
}
if (stat.isDirectory()) {
Branch IfStatement
✗ Positive was not executed (if)
if (containsElements && filename.substr(0, 2) === '__') {···
_this._loadElement(elementName, filename.substr(2), fullname, false);
} else if (filename.charAt(0) === '_') {
✗ Negative was not executed (else)
} else if (filename.charAt(0) === '_') {···
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
Branch LogicalExpression
✗ Was not returned
if (containsElements && filename.substr(0, 2) === '__') {
✗ Was not returned
if (containsElements && filename.substr(0, 2) === '__') {
if (containsElements && filename.substr(0, 2) === '__') {
_this._loadElement(elementName, filename.substr(2), fullname, false);
Branch IfStatement
✗ Positive was not executed (if)
} else if (filename.charAt(0) === '_') {···
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
✗ Negative was not executed (else)
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {···
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
} else if (filename.charAt(0) === '_') {
_this._loadMod(parentElementName, elementName, filename.substr(1), fullname);
Branch IfStatement
✗ Positive was not executed (if)
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {···
_this._processFile(fullname, stat, parentElementName, elementName);
} else if (containsElements) {
✗ Negative was not executed (else)
} else if (containsElements) {···
_this._loadElement(elementName, filename, fullname, false);
}
Branch LogicalExpression
✗ Was not returned
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
✗ Was not returned
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
} else if (filename.indexOf('.') !== -1 && filename.indexOf(requiredBaseNameWithoutExt + '.') === 0) {
_this._processFile(fullname, stat, parentElementName, elementName);
Branch IfStatement
✗ Positive was not executed (if)
} else if (containsElements) {···
_this._loadElement(elementName, filename, fullname, false);
}
✗ Negative was not executed (else)
}···
} else if (stat.isFile()) {
} else if (containsElements) {
_this._loadElement(elementName, filename, fullname, false);
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (stat.isFile()) {···
_this._processFile(fullname, stat, parentElementName, elementName);
}
✗ Negative was not executed (else)
}···
});
} else if (stat.isFile()) {
_this._processFile(fullname, stat, parentElementName, elementName);
}
});
},
/**
* Загружает уровень перепределения: загружает структуру блоков, элементов и модификаторов.
*/
Function (anonymous_282)
✗ Was not called
load: function () {···
if (this._loadPromise) {
return this._loadPromise;
}
this._loadPromise = Vow.promise();

var _this = this;
if (this._schemeBuilder) {
var levelBuilder = new LevelBuilder();
Vow.when(this._schemeBuilder.buildLevel(this._path, levelBuilder)).then(function () {
_this.blocks = levelBuilder.getBlocks();
_this._loadPromise.fulfill(_this);
});
} else {
var path = this._path;
filterFiles(fs.readdirSync(path)).forEach(function (blockDir) {
var blockDirPath = path + '/' + blockDir;
if (fs.statSync(blockDirPath).isDirectory()) {
_this._loadElement(null, blockDir, blockDirPath, true);
}
});
this._loadPromise.fulfill(this);
}

return this._loadPromise;
}
load: function () {
Branch IfStatement
✗ Positive was not executed (if)
if (this._loadPromise) {···
return this._loadPromise;
}
✗ Negative was not executed (else)
}···
this._loadPromise = Vow.promise();
if (this._loadPromise) {
return this._loadPromise;
}
this._loadPromise = Vow.promise();
var _this = this;
Branch IfStatement
✗ Positive was not executed (if)
if (this._schemeBuilder) {···
var levelBuilder = new LevelBuilder();
Vow.when(this._schemeBuilder.buildLevel(this._path, levelBuilder)).then(function () {
_this.blocks = levelBuilder.getBlocks();
_this._loadPromise.fulfill(_this);
});
} else {
✗ Negative was not executed (else)
} else {···
var path = this._path;
filterFiles(fs.readdirSync(path)).forEach(function (blockDir) {
var blockDirPath = path + '/' + blockDir;
if (fs.statSync(blockDirPath).isDirectory()) {
_this._loadElement(null, blockDir, blockDirPath, true);
}
});
this._loadPromise.fulfill(this);
}
if (this._schemeBuilder) {
var levelBuilder = new LevelBuilder();
Function (anonymous_283)
✗ Was not called
Vow.when(this._schemeBuilder.buildLevel(this._path, levelBuilder)).then(function () {···
_this.blocks = levelBuilder.getBlocks();
_this._loadPromise.fulfill(_this);
});
Vow.when(this._schemeBuilder.buildLevel(this._path, levelBuilder)).then(function () {
_this.blocks = levelBuilder.getBlocks();
_this._loadPromise.fulfill(_this);
});
} else {
var path = this._path;
Function (anonymous_284)
✗ Was not called
filterFiles(fs.readdirSync(path)).forEach(function (blockDir) {···
var blockDirPath = path + '/' + blockDir;
if (fs.statSync(blockDirPath).isDirectory()) {
_this._loadElement(null, blockDir, blockDirPath, true);
}
});
filterFiles(fs.readdirSync(path)).forEach(function (blockDir) {
var blockDirPath = path + '/' + blockDir;
Branch IfStatement
✗ Positive was not executed (if)
if (fs.statSync(blockDirPath).isDirectory()) {···
_this._loadElement(null, blockDir, blockDirPath, true);
}
✗ Negative was not executed (else)
}···
});
if (fs.statSync(blockDirPath).isDirectory()) {
_this._loadElement(null, blockDir, blockDirPath, true);
}
});
this._loadPromise.fulfill(this);
}
return this._loadPromise;
}
});
Function filterFiles
✗ Was not called
function filterFiles(filenames) {···
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
function filterFiles(filenames) {
Function (anonymous_286)
✗ Was not called
return filenames.filter(function (filename) {···
return filename.charAt(0) !== '.';
});
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
level-builder.js
/**
* LevelBuilder
* ============
*/
var inherit = require('inherit');
var fs = require('fs');
var Vow = require('vow');
/**
* Построитель структуры уровня переопределения.
*
* @name LevelBuilder
*/
module.exports = inherit({
/**
* Конструктор.
*/
Function (anonymous_287)
✗ Was not called
__constructor: function () {···
this._blocks = {};
},
__constructor: function () {
this._blocks = {};
},
/**
* Добавляет декларацию файла.
* @param {String} filename
* @param {String} blockName
* @param {String} elemName
* @param {String} modName
* @param {String} modVal
*/
Function (anonymous_288)
✗ Was not called
addFile: function (filename, blockName, elemName, modName, modVal) {···
var baseName = filename.split('/').slice(-1)[0];
var baseNameParts = baseName.split('.');
var stat = fs.statSync(filename);
var suffix = baseNameParts.slice(1).join('.');
var fileInfo = {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
if (fileInfo.isDirectory) {
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}

var block = this._blocks[blockName] || (this._blocks[blockName] = {
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
var destElement;
if (elemName) {
destElement = block.elements[elemName] || (block.elements[elemName] = {
name: elemName,
files: [],
dirs: [],
mods: {}
});
} else {
destElement = block;
}
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
if (modName) {
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
destElement[collectionKey].push(fileInfo);
}
},
addFile: function (filename, blockName, elemName, modName, modVal) {
var baseName = filename.split('/').slice(-1)[0];
var baseNameParts = baseName.split('.');
var stat = fs.statSync(filename);
var suffix = baseNameParts.slice(1).join('.');
var fileInfo = {
name: baseName,
fullname: filename,
suffix: suffix,
mtime: stat.mtime.getTime(),
isDirectory: stat.isDirectory()
};
Branch IfStatement
✗ Positive was not executed (if)
if (fileInfo.isDirectory) {···
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
✗ Negative was not executed (else)
}···

var block = this._blocks[blockName] || (this._blocks[blockName] = {
if (fileInfo.isDirectory) {
Function (anonymous_289)
✗ Was not called
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {···
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
fileInfo.files = filterFiles(fs.readdirSync(filename)).map(function (subFilename) {
var subFullname = filename + '/' + subFilename;
var subStat = fs.statSync(subFullname);
return {
name: subFilename,
fullname: subFullname,
suffix: subFilename.split('.').slice(1).join('.'),
mtime: subStat.mtime.getTime(),
isDirectory: subStat.isDirectory()
};
});
}
Branch LogicalExpression
✗ Was not returned
var block = this._blocks[blockName] || (this._blocks[blockName] = {···
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
✗ Was not returned
var block = this._blocks[blockName] || (this._blocks[blockName] = {
var block = this._blocks[blockName] || (this._blocks[blockName] = {
name: blockName,
files: [],
dirs: [],
elements: {},
mods: {}
});
var destElement;
Branch IfStatement
✗ Positive was not executed (if)
if (elemName) {···
destElement = block.elements[elemName] || (block.elements[elemName] = {
name: elemName,
files: [],
dirs: [],
mods: {}
});
} else {
✗ Negative was not executed (else)
} else {···
destElement = block;
}
if (elemName) {
Branch LogicalExpression
✗ Was not returned
destElement = block.elements[elemName] || (block.elements[elemName] = {···
name: elemName,
files: [],
dirs: [],
mods: {}
});
✗ Was not returned
destElement = block.elements[elemName] || (block.elements[elemName] = {
destElement = block.elements[elemName] || (block.elements[elemName] = {
name: elemName,
files: [],
dirs: [],
mods: {}
});
} else {
destElement = block;
}
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
✗ Negative was not returned (: ...)
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
var collectionKey = fileInfo.isDirectory ? 'dirs' : 'files';
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
✗ Negative was not executed (else)
} else {···
destElement[collectionKey].push(fileInfo);
}
if (modName) {
Branch LogicalExpression
✗ Was not returned
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
✗ Was not returned
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
var mod = destElement.mods[modName] || (destElement.mods[modName] = {});
Branch LogicalExpression
✗ Was not returned
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
✗ Was not returned
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
var modValueFiles = (mod[modVal] || (mod[modVal] = {files: [], dirs: []}))[collectionKey];
modValueFiles.push(fileInfo);
} else {
destElement[collectionKey].push(fileInfo);
}
},
/**
* Возвращает структуру блоков/элементов/модификаторов.
* @returns {Object}
*/
Function (anonymous_290)
✗ Was not called
getBlocks: function () {···
return this._blocks;
},
getBlocks: function () {
return this._blocks;
},
/**
* Выполняет построение уровня переопределения.
* @returns {Promise}
*/
Function (anonymous_291)
✗ Was not called
build: function () {···
return Vow.fulfill();
}
build: function () {
return Vow.fulfill();
}
});
Function filterFiles
✗ Was not called
function filterFiles(filenames) {···
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
function filterFiles(filenames) {
Function (anonymous_293)
✗ Was not called
return filenames.filter(function (filename) {···
return filename.charAt(0) !== '.';
});
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
levels.js
/**
* Levels
* ======
*/
var inherit = require('inherit');
/**
* Levels — класс для работы со списком уровней переопределения.
* @name Levels
*/
module.exports = inherit({
/**
* Конструктор.
* @param {Level[]} items Уровни переопределения.
*/
Function (anonymous_294)
✗ Was not called
__constructor: function (items) {···
this.items = items;
},
__constructor: function (items) {
this.items = items;
},
/**
* Возвращает объектные представления блоков по имени.
* @param {String} blockName
* @returns {Object[]}
*/
Function (anonymous_295)
✗ Was not called
getBlocks: function (blockName) {···
var block;
var blocks = [];
for (var i = 0, l = this.items.length; i < l; i++) {
block = this.items[i].blocks[blockName];
if (block) {
blocks.push(block);
}
}
return blocks;
},
getBlocks: function (blockName) {
var block;
var blocks = [];
for (var i = 0, l = this.items.length; i < l; i++) {
block = this.items[i].blocks[blockName];
Branch IfStatement
✗ Positive was not executed (if)
if (block) {···
blocks.push(block);
}
✗ Negative was not executed (else)
}···
}
if (block) {
blocks.push(block);
}
}
return blocks;
},
/**
* Возвращает объектные представления элементов по имени.
* @param {String} blockName
* @param {String} elemName
* @returns {Object[]}
*/
Function (anonymous_296)
✗ Was not called
getElems: function (blockName, elemName) {···
var block;
var elements = [];
for (var i = 0, l = this.items.length; i < l; i++) {
block = this.items[i].blocks[blockName];
if (block && block.elements[elemName]) {
elements.push(block.elements[elemName]);
}
}
return elements;
},
getElems: function (blockName, elemName) {
var block;
var elements = [];
for (var i = 0, l = this.items.length; i < l; i++) {
block = this.items[i].blocks[blockName];
Branch IfStatement
✗ Positive was not executed (if)
if (block && block.elements[elemName]) {···
elements.push(block.elements[elemName]);
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
if (block && block.elements[elemName]) {
✗ Was not returned
if (block && block.elements[elemName]) {
if (block && block.elements[elemName]) {
elements.push(block.elements[elemName]);
}
}
return elements;
},
/**
* Возвращает файлы и директории по декларации блока.
* @param {String} blockName
* @param {String} modName
* @param {String} modVal
* @returns {{files: Array, dirs: Array}}
*/
Function (anonymous_297)
✗ Was not called
getBlockEntities: function (blockName, modName, modVal) {···
var block;
var files = [];
var dirs = [];
var blocks = this.getBlocks(blockName);
for (var i = 0, l = blocks.length; i < l; i++) {
block = blocks[i];
if (modName) {
if (block.mods[modName] && block.mods[modName][modVal || '']) {
files = files.concat(block.mods[modName][modVal || ''].files);
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
}
} else {
files = files.concat(block.files);
dirs = dirs.concat(block.dirs);
}
}
return {files: files, dirs: dirs};
},
getBlockEntities: function (blockName, modName, modVal) {
var block;
var files = [];
var dirs = [];
var blocks = this.getBlocks(blockName);
for (var i = 0, l = blocks.length; i < l; i++) {
block = blocks[i];
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
if (block.mods[modName] && block.mods[modName][modVal || '']) {
files = files.concat(block.mods[modName][modVal || ''].files);
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
}
} else {
✗ Negative was not executed (else)
} else {···
files = files.concat(block.files);
dirs = dirs.concat(block.dirs);
}
if (modName) {
Branch IfStatement
✗ Positive was not executed (if)
if (block.mods[modName] && block.mods[modName][modVal || '']) {···
files = files.concat(block.mods[modName][modVal || ''].files);
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
}
✗ Negative was not executed (else)
}···
} else {
Branch LogicalExpression
✗ Was not returned
if (block.mods[modName] && block.mods[modName][modVal || '']) {
✗ Was not returned
if (block.mods[modName] && block.mods[modName][modVal || '']) {
Branch LogicalExpression
✗ Was not returned
if (block.mods[modName] && block.mods[modName][modVal || '']) {
✗ Was not returned
if (block.mods[modName] && block.mods[modName][modVal || '']) {
if (block.mods[modName] && block.mods[modName][modVal || '']) {
Branch LogicalExpression
✗ Was not returned
files = files.concat(block.mods[modName][modVal || ''].files);
✗ Was not returned
files = files.concat(block.mods[modName][modVal || ''].files);
files = files.concat(block.mods[modName][modVal || ''].files);
Branch LogicalExpression
✗ Was not returned
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
✗ Was not returned
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
dirs = dirs.concat(block.mods[modName][modVal || ''].dirs);
}
} else {
files = files.concat(block.files);
dirs = dirs.concat(block.dirs);
}
}
return {files: files, dirs: dirs};
},
/**
* Возвращает файлы и директории по декларации элемента.
* @param {String} blockName
* @param {String} elemName
* @param {String} modName
* @param {String} modVal
* @returns {{files: Array, dirs: Array}}
*/
Function (anonymous_298)
✗ Was not called
getElemEntities: function (blockName, elemName, modName, modVal) {···
var elem;
var files = [];
var dirs = [];
var elems = this.getElems(blockName, elemName);
for (var i = 0, l = elems.length; i < l; i++) {
elem = elems[i];
if (modName) {
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
files = files.concat(elem.mods[modName][modVal || ''].files);
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
}
} else {
files = files.concat(elem.files);
dirs = dirs.concat(elem.dirs);
}
}
return {files: files, dirs: dirs};
},
getElemEntities: function (blockName, elemName, modName, modVal) {
var elem;
var files = [];
var dirs = [];
var elems = this.getElems(blockName, elemName);
for (var i = 0, l = elems.length; i < l; i++) {
elem = elems[i];
Branch IfStatement
✗ Positive was not executed (if)
if (modName) {···
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
files = files.concat(elem.mods[modName][modVal || ''].files);
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
}
} else {
✗ Negative was not executed (else)
} else {···
files = files.concat(elem.files);
dirs = dirs.concat(elem.dirs);
}
if (modName) {
Branch IfStatement
✗ Positive was not executed (if)
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {···
files = files.concat(elem.mods[modName][modVal || ''].files);
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
}
✗ Negative was not executed (else)
}···
} else {
Branch LogicalExpression
✗ Was not returned
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
✗ Was not returned
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
Branch LogicalExpression
✗ Was not returned
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
✗ Was not returned
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
if (elem.mods[modName] && elem.mods[modName][modVal || '']) {
Branch LogicalExpression
✗ Was not returned
files = files.concat(elem.mods[modName][modVal || ''].files);
✗ Was not returned
files = files.concat(elem.mods[modName][modVal || ''].files);
files = files.concat(elem.mods[modName][modVal || ''].files);
Branch LogicalExpression
✗ Was not returned
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
✗ Was not returned
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
dirs = dirs.concat(elem.mods[modName][modVal || ''].dirs);
}
} else {
files = files.concat(elem.files);
dirs = dirs.concat(elem.dirs);
}
}
return {files: files, dirs: dirs};
},
/**
* Возвращает файлы по декларации блока.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {String} blockName
* @param {String} modName
* @param {String} modVal
* @returns {Object[]}
*/
Function (anonymous_299)
✗ Was not called
getBlockFiles: function (blockName, modName, modVal) {···
return this.getBlockEntities(blockName, modName, modVal).files;
},
getBlockFiles: function (blockName, modName, modVal) {
return this.getBlockEntities(blockName, modName, modVal).files;
},
/**
* Возвращает файлы по декларации элемента.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {String} blockName
* @param {String} elemName
* @param {String} modName
* @param {String} modVal
* @returns {Object[]}
*/
Function (anonymous_300)
✗ Was not called
getElemFiles: function (blockName, elemName, modName, modVal) {···
return this.getElemEntities(blockName, elemName, modName, modVal).files;
},
getElemFiles: function (blockName, elemName, modName, modVal) {
return this.getElemEntities(blockName, elemName, modName, modVal).files;
},
/**
* Возвращает файлы на основе декларации.
* Каждый файл описывается в виде:
* { fullname: <абсолютный путь к файлу>, name: <имя файла>, suffix: <суффикс>, mtime: <время изменения> }
* @param {String} blockName
* @param {String} elemName
* @param {String} modName
* @param {String} modVal
* @returns {Object[]}
*/
Function (anonymous_301)
✗ Was not called
getFilesByDecl: function (blockName, elemName, modName, modVal) {···
if (elemName) {
return this.getElemFiles(blockName, elemName, modName, modVal);
} else {
return this.getBlockFiles(blockName, modName, modVal);
}
},
getFilesByDecl: function (blockName, elemName, modName, modVal) {
Branch IfStatement
✗ Positive was not executed (if)
if (elemName) {···
return this.getElemFiles(blockName, elemName, modName, modVal);
} else {
✗ Negative was not executed (else)
} else {···
return this.getBlockFiles(blockName, modName, modVal);
}
if (elemName) {
return this.getElemFiles(blockName, elemName, modName, modVal);
} else {
return this.getBlockFiles(blockName, modName, modVal);
}
},
/**
* Возвращает файлы на основе суффикса.
* @param {String} suffix
* @returns {Object[]}
*/
Function (anonymous_302)
✗ Was not called
getFilesBySuffix: function (suffix) {···
var files = [];
this.items.forEach(function (level) {
var blocks = level.blocks;
Object.keys(blocks).forEach(function (blockName) {
files = files.concat(getFilesInElementBySuffix(blocks[blockName], suffix));
});
});
return files;
},
getFilesBySuffix: function (suffix) {
var files = [];
Function (anonymous_303)
✗ Was not called
this.items.forEach(function (level) {···
var blocks = level.blocks;
Object.keys(blocks).forEach(function (blockName) {
files = files.concat(getFilesInElementBySuffix(blocks[blockName], suffix));
});
});
this.items.forEach(function (level) {
var blocks = level.blocks;
Function (anonymous_304)
✗ Was not called
Object.keys(blocks).forEach(function (blockName) {···
files = files.concat(getFilesInElementBySuffix(blocks[blockName], suffix));
});
Object.keys(blocks).forEach(function (blockName) {
files = files.concat(getFilesInElementBySuffix(blocks[blockName], suffix));
});
});
return files;
},
/**
* Возвращает значения модификатора для блока.
*
* @param {String} blockName
* @param {String} modName
* @returns {String[]}
*/
Function (anonymous_305)
✗ Was not called
getModValues: function (blockName, modName) {···
var modVals = [];
this.items.forEach(function (level) {
var blockInfo = level.blocks[blockName];
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
modVals = modVals.concat(Object.keys(blockInfo.mods[modName]));
}
});
return modVals;
}
getModValues: function (blockName, modName) {
var modVals = [];
Function (anonymous_306)
✗ Was not called
this.items.forEach(function (level) {···
var blockInfo = level.blocks[blockName];
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
modVals = modVals.concat(Object.keys(blockInfo.mods[modName]));
}
});
this.items.forEach(function (level) {
var blockInfo = level.blocks[blockName];
Branch IfStatement
✗ Positive was not executed (if)
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {···
modVals = modVals.concat(Object.keys(blockInfo.mods[modName]));
}
✗ Negative was not executed (else)
}···
});
Branch LogicalExpression
✗ Was not returned
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
✗ Was not returned
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
Branch LogicalExpression
✗ Was not returned
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
✗ Was not returned
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
if (blockInfo && blockInfo.mods && blockInfo.mods[modName]) {
modVals = modVals.concat(Object.keys(blockInfo.mods[modName]));
}
});
return modVals;
}
});
Function getFilesInElementBySuffix
✗ Was not called
function getFilesInElementBySuffix(element, suffix) {···
var files = element.files.filter(function (f) { return f.suffix === suffix; });
var mods = element.mods;
var elements = element.elements;
Object.keys(mods).forEach(function (modName) {
var mod = mods[modName];
Object.keys(mod).forEach(function (modVal) {
files = files.concat(mod[modVal].files.filter(function (f) { return f.suffix === suffix; }));
});
});
if (elements) {
Object.keys(elements).forEach(function (elemName) {
files = files.concat(getFilesInElementBySuffix(elements[elemName], suffix));
});
}
return files;
}
function getFilesInElementBySuffix(element, suffix) {
Function (anonymous_308)
✗ Was not called
var files = element.files.filter(function (f) { return f.suffix === suffix; });
var files = element.files.filter(function (f) { return f.suffix === suffix; });
var mods = element.mods;
var elements = element.elements;
Function (anonymous_309)
✗ Was not called
Object.keys(mods).forEach(function (modName) {···
var mod = mods[modName];
Object.keys(mod).forEach(function (modVal) {
files = files.concat(mod[modVal].files.filter(function (f) { return f.suffix === suffix; }));
});
});
Object.keys(mods).forEach(function (modName) {
var mod = mods[modName];
Function (anonymous_310)
✗ Was not called
Object.keys(mod).forEach(function (modVal) {···
files = files.concat(mod[modVal].files.filter(function (f) { return f.suffix === suffix; }));
});
Object.keys(mod).forEach(function (modVal) {
Function (anonymous_311)
✗ Was not called
files = files.concat(mod[modVal].files.filter(function (f) { return f.suffix === suffix; }));
files = files.concat(mod[modVal].files.filter(function (f) { return f.suffix === suffix; }));
});
});
Branch IfStatement
✗ Positive was not executed (if)
if (elements) {···
Object.keys(elements).forEach(function (elemName) {
files = files.concat(getFilesInElementBySuffix(elements[elemName], suffix));
});
}
✗ Negative was not executed (else)
}···
return files;
if (elements) {
Function (anonymous_312)
✗ Was not called
Object.keys(elements).forEach(function (elemName) {···
files = files.concat(getFilesInElementBySuffix(elements[elemName], suffix));
});
Object.keys(elements).forEach(function (elemName) {
files = files.concat(getFilesInElementBySuffix(elements[elemName], suffix));
});
}
return files;
}
cache-storage.js
/**
* CacheStorage
* ============
*/
var fs = require('fs');
var dropRequireCache = require('../fs/drop-require-cache');
/**
* CacheStorage — хранилище для кэша.
* @name CacheStorage
* @param {String} filename Имя файла, в котором хранится кэш (в формате JSON).
* @constructor
*/
Function CacheStorage
✗ Was not called
function CacheStorage(filename) {···
this._filename = filename;
this._data = {};
this._mtime = 0;
}
function CacheStorage(filename) {
this._filename = filename;
this._data = {};
this._mtime = 0;
}
CacheStorage.prototype = {
/**
* Загружает кэш из файла.
*/
Function (anonymous_314)
✗ Was not called
load: function () {···
if (fs.existsSync(this._filename)) {
dropRequireCache(require, this._filename);
try {
this._data = require(this._filename);
} catch (e) {
this._data = {};
}
this._mtime = fs.statSync(this._filename).mtime.getTime();
} else {
this._data = {};
}
},
load: function () {
Branch IfStatement
✗ Positive was not executed (if)
if (fs.existsSync(this._filename)) {···
dropRequireCache(require, this._filename);
try {
this._data = require(this._filename);
} catch (e) {
this._data = {};
}
this._mtime = fs.statSync(this._filename).mtime.getTime();
} else {
✗ Negative was not executed (else)
} else {···
this._data = {};
}
if (fs.existsSync(this._filename)) {
dropRequireCache(require, this._filename);
try {
this._data = require(this._filename);
} catch (e) {
this._data = {};
}
this._mtime = fs.statSync(this._filename).mtime.getTime();
} else {
this._data = {};
}
},
/**
* Сохраняет кэш в файл.
*/
Function (anonymous_315)
✗ Was not called
save: function () {···
fs.writeFileSync(this._filename, 'module.exports = ' + JSON.stringify(this._data) + ';', 'utf8');
this._mtime = fs.statSync(this._filename).mtime.getTime();
},
save: function () {
fs.writeFileSync(this._filename, 'module.exports = ' + JSON.stringify(this._data) + ';', 'utf8');
this._mtime = fs.statSync(this._filename).mtime.getTime();
},
/**
* Возвращает значение по префику и ключу.
* @param {String} prefix
* @param {String} key
* @returns {Object}
*/
Function (anonymous_316)
✗ Was not called
get: function (prefix, key) {···
return this._data[prefix] && this._data[prefix][key];
},
get: function (prefix, key) {
Branch LogicalExpression
✗ Was not returned
return this._data[prefix] && this._data[prefix][key];
✗ Was not returned
return this._data[prefix] && this._data[prefix][key];
return this._data[prefix] && this._data[prefix][key];
},
/**
* Устанавливает значение по префиксу и ключу.
* @param {String} prefix
* @param {String} key
* @param {Object} value
*/
Function (anonymous_317)
✗ Was not called
set: function (prefix, key, value) {···
(this._data[prefix] || (this._data[prefix] = {}))[key] = value;
},
set: function (prefix, key, value) {
Branch LogicalExpression
✗ Was not returned
(this._data[prefix] || (this._data[prefix] = {}))[key] = value;
✗ Was not returned
(this._data[prefix] || (this._data[prefix] = {}))[key] = value;
(this._data[prefix] || (this._data[prefix] = {}))[key] = value;
},
/**
* Удаляет значение по префиксу и ключу.
* @param {String} prefix
* @param {String} key
*/
Function (anonymous_318)
✗ Was not called
invalidate: function (prefix, key) {···
var prefixObj = this._data[prefix];
if (prefixObj) {
delete prefixObj[key];
}
},
invalidate: function (prefix, key) {
var prefixObj = this._data[prefix];
Branch IfStatement
✗ Positive was not executed (if)
if (prefixObj) {···
delete prefixObj[key];
}
✗ Negative was not executed (else)
}···
},
if (prefixObj) {
delete prefixObj[key];
}
},
/**
* Удаляет все значения по префиксу.
* @param {String} prefix
*/
Function (anonymous_319)
✗ Was not called
dropPrefix: function (prefix) {···
delete this._data[prefix];
},
dropPrefix: function (prefix) {
delete this._data[prefix];
},
/**
* Очищает кэш.
*/
Function (anonymous_320)
✗ Was not called
drop: function () {···
this._data = {};
}
drop: function () {
this._data = {};
}
};
module.exports = CacheStorage;
cache.js
/**
* Cache
* =====
*/
var fs = require('fs');
var path = require('path');
/**
* Cache — интерфейс для кэширования.
* @name Cache
* @param {CacheStorage} storage Хранилище.
* @param {String} prefix Префикс для данного кэша в рамках хранилища.
* @constructor
*/
Function Cache
✗ Was not called
function Cache(storage, prefix) {···
this._storage = storage;
this._prefix = prefix;
}
function Cache(storage, prefix) {
this._storage = storage;
this._prefix = prefix;
}
Cache.prototype = {
/**
* Возвращает данные из кэша по ключу.
* @param {String} key
* @returns {Object}
*/
Function (anonymous_322)
✗ Was not called
get: function (key) {···
return this._storage.get(this._prefix, key);
},
get: function (key) {
return this._storage.get(this._prefix, key);
},
/**
* Устанавливает данные в кэше по ключу.
* @param {String} key
* @param {Object} value
*/
Function (anonymous_323)
✗ Was not called
set: function (key, value) {···
this._storage.set(this._prefix, key, value);
},
set: function (key, value) {
this._storage.set(this._prefix, key, value);
},
/**
* Удаляет данные кэша по ключу.
* @param {String} key
*/
Function (anonymous_324)
✗ Was not called
invalidate: function (key) {···
this._storage.invalidate(this._prefix, key);
},
invalidate: function (key) {
this._storage.invalidate(this._prefix, key);
},
/**
* Очищает кэш.
*/
Function (anonymous_325)
✗ Was not called
drop: function () {···
this._storage.dropPrefix(this._prefix);
},
drop: function () {
this._storage.dropPrefix(this._prefix);
},
/**
* Возвращает новый интерфейс к хранилищу кэша с дополненным префиксом.
* @param {String} name
* @returns {Cache}
*/
Function (anonymous_326)
✗ Was not called
subCache: function (name) {···
return new Cache(this._storage, this._prefix + '/' + name);
},
subCache: function (name) {
return new Cache(this._storage, this._prefix + '/' + name);
},
/**
* Возвращает информацию о файле по полному пути.
* @param {String} fullname
* @returns {{name: *, fullname: *, suffix: string, mtime: null}}
* @private
*/
Function (anonymous_327)
✗ Was not called
_getFileInfo: function (fullname) {···
var filename = path.basename(fullname);
var mtime = null;

if (fs.existsSync(fullname)) {
mtime = fs.statSync(fullname).mtime.getTime();
}

return {
name: filename,
fullname: fullname,
suffix: filename.split('.').slice(1).join('.'),
mtime: mtime
};
},
_getFileInfo: function (fullname) {
var filename = path.basename(fullname);
var mtime = null;
Branch IfStatement
✗ Positive was not executed (if)
if (fs.existsSync(fullname)) {···
mtime = fs.statSync(fullname).mtime.getTime();
}
✗ Negative was not executed (else)
}···

return {
if (fs.existsSync(fullname)) {
mtime = fs.statSync(fullname).mtime.getTime();
}
return {
name: filename,
fullname: fullname,
suffix: filename.split('.').slice(1).join('.'),
mtime: mtime
};
},
/**
* Возвращает true, если время изменения для файла изменилиась по данному ключу.
* В противном случае возвращает false.
* @param {String} cacheKey
* @param {String} filename
* @returns {Boolean}
*/
Function (anonymous_328)
✗ Was not called
needRebuildFile: function (cacheKey, filename) {···
var cachedFile = this.get(cacheKey);
if (cachedFile) {
return cachedFile.mtime !== this._getFileInfo(filename).mtime;
} else {
return true;
}
},
needRebuildFile: function (cacheKey, filename) {
var cachedFile = this.get(cacheKey);
Branch IfStatement
✗ Positive was not executed (if)
if (cachedFile) {···
return cachedFile.mtime !== this._getFileInfo(filename).mtime;
} else {
✗ Negative was not executed (else)
} else {···
return true;
}
if (cachedFile) {
return cachedFile.mtime !== this._getFileInfo(filename).mtime;
} else {
return true;
}
},
/**
* Кэширует информацию о файле для последующего сравнения.
* @param {String} cacheKey
* @param {String} filename
*/
Function (anonymous_329)
✗ Was not called
cacheFileInfo: function (cacheKey, filename) {···
this.set(cacheKey, this._getFileInfo(filename));
},
cacheFileInfo: function (cacheKey, filename) {
this.set(cacheKey, this._getFileInfo(filename));
},
/**
* Возвращает true, если время изменения для файлов изменились по данному ключу.
* В противном случае возвращает false.
* @param {String} cacheKey
* @param {Object[]} files
* @returns {Boolean}
*/
Function (anonymous_330)
✗ Was not called
needRebuildFileList: function (cacheKey, files) {···
var cachedFiles = this.get(cacheKey);
if (cachedFiles && Array.isArray(cachedFiles)) {
var l = files.length;
if (l !== cachedFiles.length) {
return true;
}
for (var i = 0; i < l; i++) {
var cf = cachedFiles[i];
var fileInfo = files[i];
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {
return true;
}
}
return false;
} else {
return true;
}
},
needRebuildFileList: function (cacheKey, files) {
var cachedFiles = this.get(cacheKey);
Branch IfStatement
✗ Positive was not executed (if)
if (cachedFiles && Array.isArray(cachedFiles)) {···
var l = files.length;
if (l !== cachedFiles.length) {
return true;
}
for (var i = 0; i < l; i++) {
var cf = cachedFiles[i];
var fileInfo = files[i];
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {
return true;
}
}
return false;
} else {
✗ Negative was not executed (else)
} else {···
return true;
}
Branch LogicalExpression
✗ Was not returned
if (cachedFiles && Array.isArray(cachedFiles)) {
✗ Was not returned
if (cachedFiles && Array.isArray(cachedFiles)) {
if (cachedFiles && Array.isArray(cachedFiles)) {
var l = files.length;
Branch IfStatement
✗ Positive was not executed (if)
if (l !== cachedFiles.length) {···
return true;
}
✗ Negative was not executed (else)
}···
for (var i = 0; i < l; i++) {
if (l !== cachedFiles.length) {
return true;
}
for (var i = 0; i < l; i++) {
var cf = cachedFiles[i];
var fileInfo = files[i];
Branch IfStatement
✗ Positive was not executed (if)
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {···
return true;
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {
✗ Was not returned
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {
if (cf.mtime !== fileInfo.mtime || cf.fullname !== fileInfo.fullname) {
return true;
}
}
return false;
} else {
return true;
}
},
/**
* Кэширует информацию о списке файлов для последующего сравнения.
* @param {String} cacheKey
* @param {Object[]} filelist
*/
Function (anonymous_331)
✗ Was not called
cacheFileList: function (cacheKey, filelist) {···
this.set(cacheKey, filelist);
},
cacheFileList: function (cacheKey, filelist) {
this.set(cacheKey, filelist);
},
Function (anonymous_332)
✗ Was not called
destruct: function () {···
delete this._storage;
}
destruct: function () {
delete this._storage;
}
};
module.exports = Cache;
cli.js
/**
* CLI
* ===
*
* Этот файл запускается из командной строки при сборке и прочем взаимодействии с ENB.
*/
var pkg = require('../../package.json');
var version = pkg.version;
var program = require('commander');
program
.version(version)
.parse(process.argv);
require('./make.js')(program);
require('./server.js')(program);
require('./help.js')(program);
Branch IfStatement
✗ Positive was not executed (if)
if (!program.args.length) {···
program.outputHelp();
}
✓ Negative was executed (else)
}···

program.command('*')
if (!program.args.length) {
program.outputHelp();
}
program.command('*')
.action(function () {
program.outputHelp();
});
program.parse(process.argv);
make.js
/**
* CLI/make
* ========
*
* Этот файл запускает сборку из командной строки.
*/
var MakePlatform = require('../make');
var makePlatform = new MakePlatform();
var path = require('path');
module.exports = function (program) {
program.command('make')
.option('-n, --no-cache', 'drop cache before running make')
.option('-d, --dir <dir>', 'custom project root', process.cwd())
.option('-h, --hide-warnings', 'hides warnings')
.option('--graph', 'draws build graph')
.description('build specified targets')
Function (anonymous_335)
✗ Was not called
.action(function () {···
var args = program.args.slice(0);
var cmd = args.pop();
makePlatform.init(path.resolve(cmd.dir)).then((function () {
if (cmd.hideWarnings) {
makePlatform.getLogger().hideWarnings();
}
if (cmd.cache) {
makePlatform.loadCache();
}
return makePlatform.build(args).then(function () {
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
makePlatform.saveCache();
return makePlatform.destruct();
});
}))
.then(null, function (err) {
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
console.error(err.stack);
process.exit(1);
});
});
.action(function () {
var args = program.args.slice(0);
var cmd = args.pop();
Function (anonymous_336)
✗ Was not called
makePlatform.init(path.resolve(cmd.dir)).then((function () {···
if (cmd.hideWarnings) {
makePlatform.getLogger().hideWarnings();
}
if (cmd.cache) {
makePlatform.loadCache();
}
return makePlatform.build(args).then(function () {
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
makePlatform.saveCache();
return makePlatform.destruct();
});
}))
makePlatform.init(path.resolve(cmd.dir)).then((function () {
Branch IfStatement
✗ Positive was not executed (if)
if (cmd.hideWarnings) {···
makePlatform.getLogger().hideWarnings();
}
✗ Negative was not executed (else)
}···
if (cmd.cache) {
if (cmd.hideWarnings) {
makePlatform.getLogger().hideWarnings();
}
Branch IfStatement
✗ Positive was not executed (if)
if (cmd.cache) {···
makePlatform.loadCache();
}
✗ Negative was not executed (else)
}···
return makePlatform.build(args).then(function () {
if (cmd.cache) {
makePlatform.loadCache();
}
Function (anonymous_337)
✗ Was not called
return makePlatform.build(args).then(function () {···
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
makePlatform.saveCache();
return makePlatform.destruct();
});
return makePlatform.build(args).then(function () {
Branch IfStatement
✗ Positive was not executed (if)
if (cmd.graph) {···
console.log(makePlatform.getBuildGraph().render());
}
✗ Negative was not executed (else)
}···
makePlatform.saveCache();
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
makePlatform.saveCache();
return makePlatform.destruct();
});
}))
Function (anonymous_338)
✗ Was not called
.then(null, function (err) {···
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
console.error(err.stack);
process.exit(1);
});
.then(null, function (err) {
Branch IfStatement
✗ Positive was not executed (if)
if (cmd.graph) {···
console.log(makePlatform.getBuildGraph().render());
}
✗ Negative was not executed (else)
}···
console.error(err.stack);
if (cmd.graph) {
console.log(makePlatform.getBuildGraph().render());
}
console.error(err.stack);
process.exit(1);
});
});
};
make.js
var Vow = require('vow');
var Node = require('./node');
var path = require('path');
var Logger = require('./logger');
var colors = require('./ui/colorize');
var ProjectConfig = require('./config/project-config');
var Cache = require('./cache/cache');
var CacheStorage = require('./cache/cache-storage');
var inherit = require('inherit');
var vowFs = require('./fs/async-fs');
var fs = require('fs');
var BuildGraph = require('./ui/build-graph');
var TargetNotFoundError = require('./errors/target-not-found-error');
var dropRequireCache = require('./fs/drop-require-cache');
/**
* MakePlatform
* ============
*
* Класс MakePlatform управляет сборкой проекта.
* В процессе инициализации загружается {CWD}/.bem/enb-make.js, в котором содержатся правила сборки.
* @name MakePlatform
* @class
*/
module.exports = inherit( /** @lends MakePlatform.prototype */ {
/**
* Конструктор.
*/
__constructor: function () {
this._nodes = {};
this._nodeInitPromises = {};
this._cacheStorage = null;
this._cache = null;
this._projectConfig = null;
this._cdir = null;
this._languages = null;
this._env = {};
this._mode = null;
this._makefiles = [];
this._graph = null;
this._levelNamingSchemes = {};
},
/**
* Инициализация make-платформы.
* Создает директорию для хранения временных файлов, загружает конфиг для сборки.
* @param {String} cdir Путь к директории с проектом.
* @param {String} [mode] Режим сборки. Например, development.
* @returns {Promise}
*/
Function (anonymous_340)
✗ Was not called
init: function (cdir, mode) {···
this._mode = mode = mode || process.env.YENV || 'development';

this._cdir = cdir;

var _this = this;
var projectName = path.basename(cdir);
var configDir = this._getConfigDir();
var makefilePath = this._getMakeFile('make');
var personalMakefilePath = this._getMakeFile('make.personal');

if (!makefilePath) {
throw new Error('Cannot find make configuration file.');
}

this._projectName = projectName;
this._logger = new Logger();
this._buildState = {};
this._makefiles = [makefilePath, personalMakefilePath];
this._graph = new BuildGraph(projectName);

var projectConfig = this._projectConfig = new ProjectConfig(cdir);

try {
dropRequireCache(require, makefilePath);
require(makefilePath)(projectConfig);
} catch (err) {
return Vow.reject(err);
}

if (personalMakefilePath) {
dropRequireCache(require, personalMakefilePath);
require(personalMakefilePath)(projectConfig);
}

this._makefiles = this._makefiles.concat(projectConfig.getIncludedConfigFilenames());

var modeConfig = projectConfig.getModeConfig(mode);
if (modeConfig) {
modeConfig.exec(null, projectConfig);
}

this._languages = projectConfig.getLanguages();
this._env = projectConfig.getEnvValues();
this._levelNamingSchemes = projectConfig.getLevelNamingSchemes();

projectConfig.task('clean', function (task) {
return task.cleanTargets([].slice.call(arguments, 1));
});

var tmpDir = configDir + '/tmp';

return vowFs.makeDir(tmpDir).then(function () {
_this._cacheStorage = new CacheStorage(tmpDir + '/cache.js');
_this._nodes = {};
});
},
init: function (cdir, mode) {
Branch LogicalExpression
✗ Was not returned
this._mode = mode = mode || process.env.YENV || 'development';
✗ Was not returned
this._mode = mode = mode || process.env.YENV || 'development';
Branch LogicalExpression
✗ Was not returned
this._mode = mode = mode || process.env.YENV || 'development';
✗ Was not returned
this._mode = mode = mode || process.env.YENV || 'development';
this._mode = mode = mode || process.env.YENV || 'development';
this._cdir = cdir;
var _this = this;
var projectName = path.basename(cdir);
var configDir = this._getConfigDir();
var makefilePath = this._getMakeFile('make');
var personalMakefilePath = this._getMakeFile('make.personal');
Branch IfStatement
✗ Positive was not executed (if)
if (!makefilePath) {···
throw new Error('Cannot find make configuration file.');
}
✗ Negative was not executed (else)
}···

this._projectName = projectName;
if (!makefilePath) {
throw new Error('Cannot find make configuration file.');
}
this._projectName = projectName;
this._logger = new Logger();
this._buildState = {};
this._makefiles = [makefilePath, personalMakefilePath];
this._graph = new BuildGraph(projectName);
var projectConfig = this._projectConfig = new ProjectConfig(cdir);
try {
dropRequireCache(require, makefilePath);
require(makefilePath)(projectConfig);
} catch (err) {
return Vow.reject(err);
}
Branch IfStatement
✗ Positive was not executed (if)
if (personalMakefilePath) {···
dropRequireCache(require, personalMakefilePath);
require(personalMakefilePath)(projectConfig);
}
✗ Negative was not executed (else)
}···

this._makefiles = this._makefiles.concat(projectConfig.getIncludedConfigFilenames());
if (personalMakefilePath) {
dropRequireCache(require, personalMakefilePath);
require(personalMakefilePath)(projectConfig);
}
this._makefiles = this._makefiles.concat(projectConfig.getIncludedConfigFilenames());
var modeConfig = projectConfig.getModeConfig(mode);
Branch IfStatement
✗ Positive was not executed (if)
if (modeConfig) {···
modeConfig.exec(null, projectConfig);
}
✗ Negative was not executed (else)
}···

this._languages = projectConfig.getLanguages();
if (modeConfig) {
modeConfig.exec(null, projectConfig);
}
this._languages = projectConfig.getLanguages();
this._env = projectConfig.getEnvValues();
this._levelNamingSchemes = projectConfig.getLevelNamingSchemes();
Function (anonymous_341)
✗ Was not called
projectConfig.task('clean', function (task) {···
return task.cleanTargets([].slice.call(arguments, 1));
});
projectConfig.task('clean', function (task) {
return task.cleanTargets([].slice.call(arguments, 1));
});
var tmpDir = configDir + '/tmp';
Function (anonymous_342)
✗ Was not called
return vowFs.makeDir(tmpDir).then(function () {···
_this._cacheStorage = new CacheStorage(tmpDir + '/cache.js');
_this._nodes = {};
});
return vowFs.makeDir(tmpDir).then(function () {
_this._cacheStorage = new CacheStorage(tmpDir + '/cache.js');
_this._nodes = {};
});
},
/**
* Возвращает абсолютный путь к директории с проектом.
* @returns {String}
*/
Function (anonymous_343)
✗ Was not called
getDir: function () {···
return this._cdir;
},
getDir: function () {
return this._cdir;
},
/**
* Возвращает абсолютный путь к директории с конфигурационными файлами.
* В качестве директории ожидается либо .enb/, либо .bem/.
* @returns {string}
* @private
*/
Function (anonymous_344)
✗ Was not called
_getConfigDir: function () {···
var cdir = this.getDir();
var possibleDirs = ['.enb', '.bem'];
var configDir;
var isConfigDirExists = possibleDirs.some(function (dir) {
configDir = path.join(cdir, dir);
return fs.existsSync(configDir);
});
if (isConfigDirExists) {
return configDir;
} else {
throw new Error('Cannot find enb config directory. Should be either .enb/ or .bem/.');
}
},
_getConfigDir: function () {
var cdir = this.getDir();
var possibleDirs = ['.enb', '.bem'];
var configDir;
Function (anonymous_345)
✗ Was not called
var isConfigDirExists = possibleDirs.some(function (dir) {···
configDir = path.join(cdir, dir);
return fs.existsSync(configDir);
});
var isConfigDirExists = possibleDirs.some(function (dir) {
configDir = path.join(cdir, dir);
return fs.existsSync(configDir);
});
Branch IfStatement
✗ Positive was not executed (if)
if (isConfigDirExists) {···
return configDir;
} else {
✗ Negative was not executed (else)
} else {···
throw new Error('Cannot find enb config directory. Should be either .enb/ or .bem/.');
}
if (isConfigDirExists) {
return configDir;
} else {
throw new Error('Cannot find enb config directory. Should be either .enb/ or .bem/.');
}
},
/**
* Возвращает путь к указанному конфигу сборки.
* Если файлов make.js и make.personal.js не существует, то пробуем искать файлы с префиксом enb-.
* @param {String} file Название конфига (основной или персональный).
* @returns {String}
* @private
*/
Function (anonymous_346)
✗ Was not called
_getMakeFile: function (file) {···
var configDir = this._getConfigDir();
var possiblePrefixes = ['enb-', ''];
var makeFile;
var isMakeFileExists = possiblePrefixes.some(function (prefix) {
makeFile = path.join(configDir, prefix + file + '.js');
return fs.existsSync(makeFile);
});
if (isMakeFileExists) {
return makeFile;
}
},
_getMakeFile: function (file) {
var configDir = this._getConfigDir();
var possiblePrefixes = ['enb-', ''];
var makeFile;
Function (anonymous_347)
✗ Was not called
var isMakeFileExists = possiblePrefixes.some(function (prefix) {···
makeFile = path.join(configDir, prefix + file + '.js');
return fs.existsSync(makeFile);
});
var isMakeFileExists = possiblePrefixes.some(function (prefix) {
makeFile = path.join(configDir, prefix + file + '.js');
return fs.existsSync(makeFile);
});
Branch IfStatement
✗ Positive was not executed (if)
if (isMakeFileExists) {···
return makeFile;
}
✗ Negative was not executed (else)
}···
},
if (isMakeFileExists) {
return makeFile;
}
},
/**
* Возвращает построитель графа сборки.
* @returns {BuildGraph}
*/
Function (anonymous_348)
✗ Was not called
getBuildGraph: function () {···
return this._graph;
},
getBuildGraph: function () {
return this._graph;
},
/**
* Загружает кэш из временной папки.
* В случае, если обновился пакет enb, либо изменился режим сборки, либо изменились make-файлы, сбрасывается кэш.
*/
Function (anonymous_349)
✗ Was not called
loadCache: function () {···
this._cacheStorage.load();
var version = require('../package.json').version;
var mtimes = this._cacheStorage.get(':make', 'makefiles') || {};
var dropCache = false;
// Invalidate cache if mode was changed.
if (this._cacheStorage.get(':make', 'mode') !== this._mode) {
dropCache = true;
}
// Invalidate cache if ENB package was updated.
if (this._cacheStorage.get(':make', 'version') !== version) {
dropCache = true;
}
// Invalidate cache if any of makefiles were updated.
var currentMTimes = this._getMakefileMTimes();
Object.keys(currentMTimes).forEach(function (makefilePath) {
if (currentMTimes[makefilePath] !== mtimes[makefilePath]) {
dropCache = true;
}
});
if (dropCache) {
this._cacheStorage.drop();
}
},
loadCache: function () {
this._cacheStorage.load();
var version = require('../package.json').version;
Branch LogicalExpression
✗ Was not returned
var mtimes = this._cacheStorage.get(':make', 'makefiles') || {};
✗ Was not returned
var mtimes = this._cacheStorage.get(':make', 'makefiles') || {};
var mtimes = this._cacheStorage.get(':make', 'makefiles') || {};
var dropCache = false;
// Invalidate cache if mode was changed.
Branch IfStatement
✗ Positive was not executed (if)
if (this._cacheStorage.get(':make', 'mode') !== this._mode) {···
dropCache = true;
}
✗ Negative was not executed (else)
}···
// Invalidate cache if ENB package was updated.
if (this._cacheStorage.get(':make', 'mode') !== this._mode) {
dropCache = true;
}
// Invalidate cache if ENB package was updated.
Branch IfStatement
✗ Positive was not executed (if)
if (this._cacheStorage.get(':make', 'version') !== version) {···
dropCache = true;
}
✗ Negative was not executed (else)
}···
// Invalidate cache if any of makefiles were updated.
if (this._cacheStorage.get(':make', 'version') !== version) {
dropCache = true;
}
// Invalidate cache if any of makefiles were updated.
var currentMTimes = this._getMakefileMTimes();
Function (anonymous_350)
✗ Was not called
Object.keys(currentMTimes).forEach(function (makefilePath) {···
if (currentMTimes[makefilePath] !== mtimes[makefilePath]) {
dropCache = true;
}
});
Object.keys(currentMTimes).forEach(function (makefilePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (currentMTimes[makefilePath] !== mtimes[makefilePath]) {···
dropCache = true;
}
✗ Negative was not executed (else)
}···
});
if (currentMTimes[makefilePath] !== mtimes[makefilePath]) {
dropCache = true;
}
});
Branch IfStatement
✗ Positive was not executed (if)
if (dropCache) {···
this._cacheStorage.drop();
}
✗ Negative was not executed (else)
}···
},
if (dropCache) {
this._cacheStorage.drop();
}
},
/**
* Возвращает время изменения каждого загруженного make-файла в виде unix-time (.bem/enb-make.js).
* @returns {Object}
* @private
*/
Function (anonymous_351)
✗ Was not called
_getMakefileMTimes: function () {···
var res = {};
this._makefiles.forEach(function (makefilePath) {
if (fs.existsSync(makefilePath)) {
res[makefilePath] = fs.statSync(makefilePath).mtime.getTime();
}
});
return res;
},
_getMakefileMTimes: function () {
var res = {};
Function (anonymous_352)
✗ Was not called
this._makefiles.forEach(function (makefilePath) {···
if (fs.existsSync(makefilePath)) {
res[makefilePath] = fs.statSync(makefilePath).mtime.getTime();
}
});
this._makefiles.forEach(function (makefilePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (fs.existsSync(makefilePath)) {···
res[makefilePath] = fs.statSync(makefilePath).mtime.getTime();
}
✗ Negative was not executed (else)
}···
});
if (fs.existsSync(makefilePath)) {
res[makefilePath] = fs.statSync(makefilePath).mtime.getTime();
}
});
return res;
},
/**
* Сохраняет кэш во временную папку.
*/
Function (anonymous_353)
✗ Was not called
saveCache: function () {···
this._cacheStorage.set(':make', 'mode', this._mode);
this._cacheStorage.set(':make', 'version', require('../package.json').version);
this._cacheStorage.set(':make', 'makefiles', this._getMakefileMTimes());
this._cacheStorage.save();
},
saveCache: function () {
this._cacheStorage.set(':make', 'mode', this._mode);
this._cacheStorage.set(':make', 'version', require('../package.json').version);
this._cacheStorage.set(':make', 'makefiles', this._getMakefileMTimes());
this._cacheStorage.save();
},
/**
* Возвращает переменные окружения.
* @returns {Object}
*/
Function (anonymous_354)
✗ Was not called
getEnv: function () {···
return this._env;
},
getEnv: function () {
return this._env;
},
/**
* Устанавливает переменные окружения.
* @param {Object} env
*/
Function (anonymous_355)
✗ Was not called
setEnv: function (env) {···
this._env = env;
},
setEnv: function (env) {
this._env = env;
},
/**
* Возвращает хранилище кэша.
* @returns {CacheStorage}
*/
Function (anonymous_356)
✗ Was not called
getCacheStorage: function () {···
return this._cacheStorage;
},
getCacheStorage: function () {
return this._cacheStorage;
},
/**
* Устанавливает хранилище кэша.
* @param {CacheStorage} cacheStorage
*/
Function (anonymous_357)
✗ Was not called
setCacheStorage: function (cacheStorage) {···
this._cacheStorage = cacheStorage;
},
setCacheStorage: function (cacheStorage) {
this._cacheStorage = cacheStorage;
},
/**
* Возвращает языки для проекта.
* Вроде, уже больше не нужно. Надо избавиться в будущих версиях.
* @returns {String[]}
* @deprecated
*/
Function (anonymous_358)
✗ Was not called
getLanguages: function () {···
return this._languages;
},
getLanguages: function () {
return this._languages;
},
/**
* Устанавливает языки для проекта.
* Вроде, уже больше не нужно. Надо избавиться в будущих версиях.
* @param {String[]} languages
* @deprecated
*/
Function (anonymous_359)
✗ Was not called
setLanguages: function (languages) {···
this._languages = languages;
},
setLanguages: function (languages) {
this._languages = languages;
},
/**
* Возвращает логгер для сборки.
* @returns {Logger}
*/
Function (anonymous_360)
✗ Was not called
getLogger: function () {···
return this._logger;
},
getLogger: function () {
return this._logger;
},
/**
* Устанавливает логгер для сборки.
* Позволяет перенаправить вывод процесса сборки.
*
* @param {Logger} logger
*/
Function (anonymous_361)
✗ Was not called
setLogger: function (logger) {···
this._logger = logger;
},
setLogger: function (logger) {
this._logger = logger;
},
/**
* Инициализирует ноду по нужному пути.
* @param {String} nodePath
* @returns {Promise}
*/
Function (anonymous_362)
✗ Was not called
initNode: function (nodePath) {···
if (!this._nodeInitPromises[nodePath]) {
var _this = this;
var cdir = this.getDir();
var nodeConfig = this._projectConfig.getNodeConfig(nodePath);
var node = new Node(nodePath, this, this._cache);
node.setLogger(this._logger.subLogger(nodePath));
node.setBuildGraph(this._graph);
this._nodes[nodePath] = node;
this._nodeInitPromises[nodePath] = vowFs.makeDir(path.join(cdir, nodePath))
.then(function () {
return Vow.when(nodeConfig.exec());
})
.then(function () {
return Vow.all(_this._projectConfig.getNodeMaskConfigs(nodePath).map(function (nodeMaskConfig) {
return nodeMaskConfig.exec([], nodeConfig);
}));
})
.then(function () {
var mode = nodeConfig.getModeConfig(_this._mode);
return mode && mode.exec(null, nodeConfig);
})
.then(function () {
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
node.setTargetsToBuild(nodeConfig.getTargets());
node.setTargetsToClean(nodeConfig.getCleanTargets());
node.setTechs(nodeConfig.getTechs());
node.setBuildState(_this._buildState);
return node.loadTechs();
});
}
return this._nodeInitPromises[nodePath];
},
initNode: function (nodePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._nodeInitPromises[nodePath]) {···
var _this = this;
var cdir = this.getDir();
var nodeConfig = this._projectConfig.getNodeConfig(nodePath);
var node = new Node(nodePath, this, this._cache);
node.setLogger(this._logger.subLogger(nodePath));
node.setBuildGraph(this._graph);
this._nodes[nodePath] = node;
this._nodeInitPromises[nodePath] = vowFs.makeDir(path.join(cdir, nodePath))
.then(function () {
return Vow.when(nodeConfig.exec());
})
.then(function () {
return Vow.all(_this._projectConfig.getNodeMaskConfigs(nodePath).map(function (nodeMaskConfig) {
return nodeMaskConfig.exec([], nodeConfig);
}));
})
.then(function () {
var mode = nodeConfig.getModeConfig(_this._mode);
return mode && mode.exec(null, nodeConfig);
})
.then(function () {
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
node.setTargetsToBuild(nodeConfig.getTargets());
node.setTargetsToClean(nodeConfig.getCleanTargets());
node.setTechs(nodeConfig.getTechs());
node.setBuildState(_this._buildState);
return node.loadTechs();
});
}
✗ Negative was not executed (else)
}···
return this._nodeInitPromises[nodePath];
if (!this._nodeInitPromises[nodePath]) {
var _this = this;
var cdir = this.getDir();
var nodeConfig = this._projectConfig.getNodeConfig(nodePath);
var node = new Node(nodePath, this, this._cache);
node.setLogger(this._logger.subLogger(nodePath));
node.setBuildGraph(this._graph);
this._nodes[nodePath] = node;
this._nodeInitPromises[nodePath] = vowFs.makeDir(path.join(cdir, nodePath))
Function (anonymous_363)
✗ Was not called
.then(function () {···
return Vow.when(nodeConfig.exec());
})
.then(function () {
return Vow.when(nodeConfig.exec());
})
Function (anonymous_364)
✗ Was not called
.then(function () {···
return Vow.all(_this._projectConfig.getNodeMaskConfigs(nodePath).map(function (nodeMaskConfig) {
return nodeMaskConfig.exec([], nodeConfig);
}));
})
.then(function () {
Function (anonymous_365)
✗ Was not called
return Vow.all(_this._projectConfig.getNodeMaskConfigs(nodePath).map(function (nodeMaskConfig) {···
return nodeMaskConfig.exec([], nodeConfig);
}));
return Vow.all(_this._projectConfig.getNodeMaskConfigs(nodePath).map(function (nodeMaskConfig) {
return nodeMaskConfig.exec([], nodeConfig);
}));
})
Function (anonymous_366)
✗ Was not called
.then(function () {···
var mode = nodeConfig.getModeConfig(_this._mode);
return mode && mode.exec(null, nodeConfig);
})
.then(function () {
var mode = nodeConfig.getModeConfig(_this._mode);
Branch LogicalExpression
✗ Was not returned
return mode && mode.exec(null, nodeConfig);
✗ Was not returned
return mode && mode.exec(null, nodeConfig);
return mode && mode.exec(null, nodeConfig);
})
Function (anonymous_367)
✗ Was not called
.then(function () {···
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
node.setTargetsToBuild(nodeConfig.getTargets());
node.setTargetsToClean(nodeConfig.getCleanTargets());
node.setTechs(nodeConfig.getTechs());
node.setBuildState(_this._buildState);
return node.loadTechs();
});
.then(function () {
Branch LogicalExpression
✗ Was not returned
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
✗ Was not returned
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
node.setLanguages(nodeConfig.getLanguages() || _this._languages);
node.setTargetsToBuild(nodeConfig.getTargets());
node.setTargetsToClean(nodeConfig.getCleanTargets());
node.setTechs(nodeConfig.getTechs());
node.setBuildState(_this._buildState);
return node.loadTechs();
});
}
return this._nodeInitPromises[nodePath];
},
/**
* Требует сборки таргетов для указанной ноды.
* @param {String} nodePath Например, "pages/index".
* @param {String[]} sources Таргеты, которые необходимо собрать.
* @returns {Promise}
*/
Function (anonymous_368)
✗ Was not called
requireNodeSources: function (nodePath, sources) {···
var _this = this;
return this.initNode(nodePath).then(function () {
return _this._nodes[nodePath].requireSources(sources);
});
},
requireNodeSources: function (nodePath, sources) {
var _this = this;
Function (anonymous_369)
✗ Was not called
return this.initNode(nodePath).then(function () {···
return _this._nodes[nodePath].requireSources(sources);
});
return this.initNode(nodePath).then(function () {
return _this._nodes[nodePath].requireSources(sources);
});
},
/**
* Сбрасывает кэш.
*/
Function (anonymous_370)
✗ Was not called
dropCache: function () {···
this._cacheStorage.drop();
},
dropCache: function () {
this._cacheStorage.drop();
},
/**
* Возвращает массив строк путей к нодам, упорядоченные по убыванию длины.
* Сортировка по убыванию нужна для случаев, когда на файловой системе одна нода находится
* внутри другой (например, `bundles/page` и `bundles/page/bundles/header`).
*
* @returns {String[]}
* @private
*/
Function (anonymous_371)
✗ Was not called
_getNodePathsLenDesc: function () {···
return Object.keys(this._projectConfig.getNodeConfigs()).sort(function (a, b) {
return b.length - a.length;
});
},
_getNodePathsLenDesc: function () {
Function (anonymous_372)
✗ Was not called
return Object.keys(this._projectConfig.getNodeConfigs()).sort(function (a, b) {···
return b.length - a.length;
});
return Object.keys(this._projectConfig.getNodeConfigs()).sort(function (a, b) {
return b.length - a.length;
});
},
/**
* Вычисляет (на основе переданного пути к таргету и списка путей к нодам)
* к какой ноде принадлежит переданный таргет.
* @param {String} target
* @param {String[]} nodePaths
* @returns {{node: *, targets: String[]}}
* @private
*/
Function (anonymous_373)
✗ Was not called
_resolveTarget: function (target, nodePaths) {···
target = target.replace(/^(\.\/)+/g, '');
for (var i = 0, l = nodePaths.length; i < l; i++) {
var nodePath = nodePaths[i];
if (target.indexOf(nodePath) === 0) {
var npl = nodePath.length;
var charAtNpl = target.charAt(npl);
if (target.length === npl) {
return {
node: nodePath,
targets: ['*']
};
} else if (charAtNpl === '/' || charAtNpl === '\\') {
return {
node: nodePath,
targets: [target.substr(npl + 1)]
};
}
}
}
throw TargetNotFoundError('Target not found: ' + target);
},
_resolveTarget: function (target, nodePaths) {
target = target.replace(/^(\.\/)+/g, '');
for (var i = 0, l = nodePaths.length; i < l; i++) {
var nodePath = nodePaths[i];
Branch IfStatement
✗ Positive was not executed (if)
if (target.indexOf(nodePath) === 0) {···
var npl = nodePath.length;
var charAtNpl = target.charAt(npl);
if (target.length === npl) {
return {
node: nodePath,
targets: ['*']
};
} else if (charAtNpl === '/' || charAtNpl === '\\') {
return {
node: nodePath,
targets: [target.substr(npl + 1)]
};
}
}
✗ Negative was not executed (else)
}···
}
if (target.indexOf(nodePath) === 0) {
var npl = nodePath.length;
var charAtNpl = target.charAt(npl);
Branch IfStatement
✗ Positive was not executed (if)
if (target.length === npl) {···
return {
node: nodePath,
targets: ['*']
};
} else if (charAtNpl === '/' || charAtNpl === '\\') {
✗ Negative was not executed (else)
} else if (charAtNpl === '/' || charAtNpl === '\\') {···
return {
node: nodePath,
targets: [target.substr(npl + 1)]
};
}
if (target.length === npl) {
return {
node: nodePath,
targets: ['*']
};
Branch IfStatement
✗ Positive was not executed (if)
} else if (charAtNpl === '/' || charAtNpl === '\\') {···
return {
node: nodePath,
targets: [target.substr(npl + 1)]
};
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
} else if (charAtNpl === '/' || charAtNpl === '\\') {
✗ Was not returned
} else if (charAtNpl === '/' || charAtNpl === '\\') {
} else if (charAtNpl === '/' || charAtNpl === '\\') {
return {
node: nodePath,
targets: [target.substr(npl + 1)]
};
}
}
}
throw TargetNotFoundError('Target not found: ' + target);
},
/**
* Вычисляет для списка таргетов, к каким нодам они принадлежат.
* @param {String[]} targets
* @returns {Object[]}
* @private
*/
Function (anonymous_374)
✗ Was not called
_resolveTargets: function (targets) {···
var _this = this;
var buildTargets = [];
var nodeConfigs = this._projectConfig.getNodeConfigs();
var nodePathsDesc = this._getNodePathsLenDesc();
if (targets.length) {
var targetIndex = {};
targets.forEach(function (targetName) {
var target = _this._resolveTarget(targetName, nodePathsDesc);
if (targetIndex[target.node]) {
var currentTargetList = targetIndex[target.node].targets;
target.targets.forEach(function (resTargetName) {
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
} else {
targetIndex[target.node] = target;
buildTargets.push(target);
}
});
} else {
Object.keys(nodeConfigs).forEach(function (nodePath) {
buildTargets.push({
node: nodePath,
targets: ['*']
});
});
}
return buildTargets;
},
_resolveTargets: function (targets) {
var _this = this;
var buildTargets = [];
var nodeConfigs = this._projectConfig.getNodeConfigs();
var nodePathsDesc = this._getNodePathsLenDesc();
Branch IfStatement
✗ Positive was not executed (if)
if (targets.length) {···
var targetIndex = {};
targets.forEach(function (targetName) {
var target = _this._resolveTarget(targetName, nodePathsDesc);
if (targetIndex[target.node]) {
var currentTargetList = targetIndex[target.node].targets;
target.targets.forEach(function (resTargetName) {
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
} else {
targetIndex[target.node] = target;
buildTargets.push(target);
}
});
} else {
✗ Negative was not executed (else)
} else {···
Object.keys(nodeConfigs).forEach(function (nodePath) {
buildTargets.push({
node: nodePath,
targets: ['*']
});
});
}
if (targets.length) {
var targetIndex = {};
Function (anonymous_375)
✗ Was not called
targets.forEach(function (targetName) {···
var target = _this._resolveTarget(targetName, nodePathsDesc);
if (targetIndex[target.node]) {
var currentTargetList = targetIndex[target.node].targets;
target.targets.forEach(function (resTargetName) {
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
} else {
targetIndex[target.node] = target;
buildTargets.push(target);
}
});
targets.forEach(function (targetName) {
var target = _this._resolveTarget(targetName, nodePathsDesc);
Branch IfStatement
✗ Positive was not executed (if)
if (targetIndex[target.node]) {···
var currentTargetList = targetIndex[target.node].targets;
target.targets.forEach(function (resTargetName) {
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
} else {
✗ Negative was not executed (else)
} else {···
targetIndex[target.node] = target;
buildTargets.push(target);
}
if (targetIndex[target.node]) {
var currentTargetList = targetIndex[target.node].targets;
Function (anonymous_376)
✗ Was not called
target.targets.forEach(function (resTargetName) {···
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
target.targets.forEach(function (resTargetName) {
Branch IfStatement
✗ Positive was not executed (if)
if (currentTargetList.indexOf(resTargetName) === -1) {···
currentTargetList.push(resTargetName);
}
✗ Negative was not executed (else)
}···
});
if (currentTargetList.indexOf(resTargetName) === -1) {
currentTargetList.push(resTargetName);
}
});
} else {
targetIndex[target.node] = target;
buildTargets.push(target);
}
});
} else {
Function (anonymous_377)
✗ Was not called
Object.keys(nodeConfigs).forEach(function (nodePath) {···
buildTargets.push({
node: nodePath,
targets: ['*']
});
});
Object.keys(nodeConfigs).forEach(function (nodePath) {
buildTargets.push({
node: nodePath,
targets: ['*']
});
});
}
return buildTargets;
},
/**
* Запускает сборку переданного списка таргетов.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_378)
✗ Was not called
buildTargets: function (targets) {···
var _this = this;
this._cache = new Cache(this._cacheStorage, this._projectName);
try {
var targetList = this._resolveTargets(targets);
return Vow.all(targetList.map(function (target) {
return _this.initNode(target.node);
})).then(function () {
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].build(target.targets);
})).then(function (builtInfoList) {
var builtTargets = [];

builtInfoList.forEach(function (builtInfo) {
builtTargets = builtTargets.concat(builtInfo.builtTargets);
});

return {
builtTargets: builtTargets
};
});
});
} catch (err) {
return Vow.reject(err);
}
},
buildTargets: function (targets) {
var _this = this;
this._cache = new Cache(this._cacheStorage, this._projectName);
try {
var targetList = this._resolveTargets(targets);
Function (anonymous_379)
✗ Was not called
return Vow.all(targetList.map(function (target) {···
return _this.initNode(target.node);
})).then(function () {
return Vow.all(targetList.map(function (target) {
return _this.initNode(target.node);
Function (anonymous_380)
✗ Was not called
})).then(function () {···
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].build(target.targets);
})).then(function (builtInfoList) {
var builtTargets = [];

builtInfoList.forEach(function (builtInfo) {
builtTargets = builtTargets.concat(builtInfo.builtTargets);
});

return {
builtTargets: builtTargets
};
});
});
})).then(function () {
Function (anonymous_381)
✗ Was not called
return Vow.all(targetList.map(function (target) {···
return _this._nodes[target.node].build(target.targets);
})).then(function (builtInfoList) {
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].build(target.targets);
Function (anonymous_382)
✗ Was not called
})).then(function (builtInfoList) {···
var builtTargets = [];

builtInfoList.forEach(function (builtInfo) {
builtTargets = builtTargets.concat(builtInfo.builtTargets);
});

return {
builtTargets: builtTargets
};
});
})).then(function (builtInfoList) {
var builtTargets = [];
Function (anonymous_383)
✗ Was not called
builtInfoList.forEach(function (builtInfo) {···
builtTargets = builtTargets.concat(builtInfo.builtTargets);
});
builtInfoList.forEach(function (builtInfo) {
builtTargets = builtTargets.concat(builtInfo.builtTargets);
});
return {
builtTargets: builtTargets
};
});
});
} catch (err) {
return Vow.reject(err);
}
},
/**
* @returns {ProjectConfig}
*/
Function (anonymous_384)
✗ Was not called
getProjectConfig: function () {···
return this._projectConfig;
},
getProjectConfig: function () {
return this._projectConfig;
},
/**
* Запускает удаление переданного списка таргетов.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_385)
✗ Was not called
cleanTargets: function (targets) {···
var _this = this;
this._cache = new Cache(this._cacheStorage, this._projectName);
try {
var targetList = this._resolveTargets(targets);
return Vow.all(targetList.map(function (target) {
return _this.initNode(target.node);
})).then(function () {
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].clean(target.targets);
}));
});
} catch (err) {
return Vow.reject(err);
}
},
cleanTargets: function (targets) {
var _this = this;
this._cache = new Cache(this._cacheStorage, this._projectName);
try {
var targetList = this._resolveTargets(targets);
Function (anonymous_386)
✗ Was not called
return Vow.all(targetList.map(function (target) {···
return _this.initNode(target.node);
})).then(function () {
return Vow.all(targetList.map(function (target) {
return _this.initNode(target.node);
Function (anonymous_387)
✗ Was not called
})).then(function () {···
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].clean(target.targets);
}));
});
})).then(function () {
Function (anonymous_388)
✗ Was not called
return Vow.all(targetList.map(function (target) {···
return _this._nodes[target.node].clean(target.targets);
}));
return Vow.all(targetList.map(function (target) {
return _this._nodes[target.node].clean(target.targets);
}));
});
} catch (err) {
return Vow.reject(err);
}
},
/**
* Запускает выполнение таска.
* @param {String} taskName
* @param {String[]} args
* @returns {Promise}
*/
Function (anonymous_389)
✗ Was not called
buildTask: function (taskName, args) {···
var task = this._projectConfig.getTaskConfig(taskName);
task.setMakePlatform(this);
return Vow.when(task.exec(args));
},
buildTask: function (taskName, args) {
var task = this._projectConfig.getTaskConfig(taskName);
task.setMakePlatform(this);
return Vow.when(task.exec(args));
},
/**
* Деструктор.
*/
Function (anonymous_390)
✗ Was not called
destruct: function () {···
this._buildState = null;
delete this._projectConfig;
var nodes = this._nodes;
Object.keys(nodes).forEach(function (nodeName) {
nodes[nodeName].destruct();
});
delete this._nodes;
if (this._cacheStorage) {
this._cacheStorage.drop();
delete this._cacheStorage;
}
if (this._cache) {
this._cache.destruct();
delete this._cache;
}
delete this._levelNamingSchemes;
},
destruct: function () {
this._buildState = null;
delete this._projectConfig;
var nodes = this._nodes;
Function (anonymous_391)
✗ Was not called
Object.keys(nodes).forEach(function (nodeName) {···
nodes[nodeName].destruct();
});
Object.keys(nodes).forEach(function (nodeName) {
nodes[nodeName].destruct();
});
delete this._nodes;
Branch IfStatement
✗ Positive was not executed (if)
if (this._cacheStorage) {···
this._cacheStorage.drop();
delete this._cacheStorage;
}
✗ Negative was not executed (else)
}···
if (this._cache) {
if (this._cacheStorage) {
this._cacheStorage.drop();
delete this._cacheStorage;
}
Branch IfStatement
✗ Positive was not executed (if)
if (this._cache) {···
this._cache.destruct();
delete this._cache;
}
✗ Negative was not executed (else)
}···
delete this._levelNamingSchemes;
if (this._cache) {
this._cache.destruct();
delete this._cache;
}
delete this._levelNamingSchemes;
},
/**
* Запускает сборку.
* Может запустить либо сборку таргетов, либо запуск тасков.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_392)
✗ Was not called
build: function (targets) {···
var promise = Vow.promise();
var startTime = new Date();
var _this = this;
var targetTask;
try {
this._logger.log('build started');
if (targets.length && this._projectConfig.getTaskConfig(targets[0])) {
targetTask = this.buildTask(targets[0], targets.slice(1));
} else {
targetTask = this.buildTargets(targets);
}
targetTask.then(function () {
_this._logger.log('build finished - ' + colors.red((new Date() - startTime) + 'ms'));
Object.keys(_this._nodes).forEach(function (nodeName) {
_this._nodes[nodeName].getLogger().setEnabled(false);
});
promise.fulfill();
}, function (err) {
_this._logger.log('build failed');
promise.reject(err);
});
} catch (err) {
promise.reject(err);
}
return promise;
},
build: function (targets) {
var promise = Vow.promise();
var startTime = new Date();
var _this = this;
var targetTask;
try {
this._logger.log('build started');
Branch IfStatement
✗ Positive was not executed (if)
if (targets.length && this._projectConfig.getTaskConfig(targets[0])) {···
targetTask = this.buildTask(targets[0], targets.slice(1));
} else {
✗ Negative was not executed (else)
} else {···
targetTask = this.buildTargets(targets);
}
Branch LogicalExpression
✗ Was not returned
if (targets.length && this._projectConfig.getTaskConfig(targets[0])) {
✗ Was not returned
if (targets.length && this._projectConfig.getTaskConfig(targets[0])) {
if (targets.length && this._projectConfig.getTaskConfig(targets[0])) {
targetTask = this.buildTask(targets[0], targets.slice(1));
} else {
targetTask = this.buildTargets(targets);
}
Function (anonymous_393)
✗ Was not called
targetTask.then(function () {···
_this._logger.log('build finished - ' + colors.red((new Date() - startTime) + 'ms'));
Object.keys(_this._nodes).forEach(function (nodeName) {
_this._nodes[nodeName].getLogger().setEnabled(false);
});
promise.fulfill();
}, function (err) {
targetTask.then(function () {
_this._logger.log('build finished - ' + colors.red((new Date() - startTime) + 'ms'));
Function (anonymous_394)
✗ Was not called
Object.keys(_this._nodes).forEach(function (nodeName) {···
_this._nodes[nodeName].getLogger().setEnabled(false);
});
Object.keys(_this._nodes).forEach(function (nodeName) {
_this._nodes[nodeName].getLogger().setEnabled(false);
});
promise.fulfill();
Function (anonymous_395)
✗ Was not called
}, function (err) {···
_this._logger.log('build failed');
promise.reject(err);
});
}, function (err) {
_this._logger.log('build failed');
promise.reject(err);
});
} catch (err) {
promise.reject(err);
}
return promise;
},
/**
* Возвращает схему именования для уровня переопределения.
* Схема именования содержит два метода:
* ```javascript
* // Выполняет построение структуры файлов уровня переопределения, используя методы инстанции класса LevelBuilder.
* {Promise} buildLevel( {String} levelPath, {LevelBuilder} levelBuilder )
* // Возвращает путь к файлу на основе пути к уровню переопределения и BEM-описания.
* {String} buildFilePath(
* {String} levelPath, {String} blockName, {String} elemName, {String} modName, {String} modVal
* )
* ```
* @returns {Object|undefined}
*/
Function (anonymous_396)
✗ Was not called
getLevelNamingScheme: function (levelPath) {···
return this._levelNamingSchemes[levelPath];
}
getLevelNamingScheme: function (levelPath) {
return this._levelNamingSchemes[levelPath];
}
});
node.js
/**
* Node
* ====
*/
var Vow = require('vow');
var fs = require('fs');
var vowFs = require('./fs/async-fs');
var path = require('path');
var inherit = require('inherit');
var TargetNotFoundEror = require('./errors/target-not-found-error');
/**
* Нода — директория, в которой происходит сборка. Например, сборка страницы.
* Класс Node управляет сборкой в рамках ноды.
* @name Node
* @class
*/
module.exports = inherit( /** @lends Node.prototype */ {
/**
* Конструктор.
* @param {String} nodePath
* @param {MakePlatform} makePlatform
* @param {Cache} cache
*/
Function (anonymous_397)
✗ Was not called
__constructor: function (nodePath, makePlatform, cache) {···
var root = makePlatform.getDir();
/**
* Ссылка на платформу.
* @type {MakePlatform}
* @name Node.prototype._makePlatform
* @private
*/
this._makePlatform = makePlatform;
/**
* Путь к директории с нодой относительно корня проекта.
* @type {String}
* @name Node.prototype._path
* @private
*/
this._path = nodePath;
/**
* Абсолютный путь к корню проекта.
* @type {String}
* @name Node.prototype._root
* @private
*/
this._root = root;
/**
* Абсолютный путь к директории с нодой.
* @type {String}
* @name Node.prototype._dirname
* @private
*/
this._dirname = root + '/' + nodePath;
/**
* Имя директории с нодой. Например, "index" для ноды "pages/index".
* @type {String}
* @name Node.prototype._targetName
* @private
*/
this._targetName = path.basename(nodePath);
/**
* Зарегистрированные технологии.
* @type {Tech[]}
* @name Node.prototype._techs
* @private
*/
this._techs = [];
/**
* Ссылка на кэш платформы.
* @type {Cache}
* @name Node.prototype._cache
* @private
*/
this._cache = cache;
/**
* Кэш для ноды.
* @type {Cache}
* @name Node.prototype._nodeCache
* @private
*/
this._nodeCache = cache.subCache(nodePath);
/**
* Логгер для ноды.
* @type {Logger}
* @name Node.prototype._logger
* @private
*/
this._logger = null;
/**
* Зарегистрированные таргеты со ссылками на технологии и с промисами на выполнение таргетов.
* Формат:
* { 'index.js': { tech: <ссылка на технологию>, started: true|false, promise: <промис на выполнение> } }
* @type {Object}
* @name Node.prototype._targetNames
* @private
*/
this._targetNames = {};
/**
* Список таргетов на сборку.
* @type {String[]}
* @name Node.prototype._targetNamesToBuild
* @private
*/
this._targetNamesToBuild = [];
/**
* Список таргетов на удаление (для команды enb make clean).
* @type {String[]}
* @name Node.prototype._targetNamesToClean
* @private
*/
this._targetNamesToClean = [];
// TODO: Удалить this._languages.
/**
* Список языков для ноды. Уже почти не используется в связи с переходом на новый формат настроек.
* Будет удалено в будущих версиях.
* @type {String[]}
* @name Node.prototype._languages
* @deprecated
* @private
*/
this._languages = null;
/**
* Промис на регистрацию всех таргетов для добавленных технологий.
* @type {Promise}
* @name Node.prototype._registerTargetsPromise
* @private
*/
this._registerTargetsPromise = null;
/**
* Построитель графа сборки.
* @type {BuildGraph}
* @name Node.prototype._graph
* @private
*/
this._graph = null;
},
__constructor: function (nodePath, makePlatform, cache) {
var root = makePlatform.getDir();
/**
* Ссылка на платформу.
* @type {MakePlatform}
* @name Node.prototype._makePlatform
* @private
*/
this._makePlatform = makePlatform;
/**
* Путь к директории с нодой относительно корня проекта.
* @type {String}
* @name Node.prototype._path
* @private
*/
this._path = nodePath;
/**
* Абсолютный путь к корню проекта.
* @type {String}
* @name Node.prototype._root
* @private
*/
this._root = root;
/**
* Абсолютный путь к директории с нодой.
* @type {String}
* @name Node.prototype._dirname
* @private
*/
this._dirname = root + '/' + nodePath;
/**
* Имя директории с нодой. Например, "index" для ноды "pages/index".
* @type {String}
* @name Node.prototype._targetName
* @private
*/
this._targetName = path.basename(nodePath);
/**
* Зарегистрированные технологии.
* @type {Tech[]}
* @name Node.prototype._techs
* @private
*/
this._techs = [];
/**
* Ссылка на кэш платформы.
* @type {Cache}
* @name Node.prototype._cache
* @private
*/
this._cache = cache;
/**
* Кэш для ноды.
* @type {Cache}
* @name Node.prototype._nodeCache
* @private
*/
this._nodeCache = cache.subCache(nodePath);
/**
* Логгер для ноды.
* @type {Logger}
* @name Node.prototype._logger
* @private
*/
this._logger = null;
/**
* Зарегистрированные таргеты со ссылками на технологии и с промисами на выполнение таргетов.
* Формат:
* { 'index.js': { tech: <ссылка на технологию>, started: true|false, promise: <промис на выполнение> } }
* @type {Object}
* @name Node.prototype._targetNames
* @private
*/
this._targetNames = {};
/**
* Список таргетов на сборку.
* @type {String[]}
* @name Node.prototype._targetNamesToBuild
* @private
*/
this._targetNamesToBuild = [];
/**
* Список таргетов на удаление (для команды enb make clean).
* @type {String[]}
* @name Node.prototype._targetNamesToClean
* @private
*/
this._targetNamesToClean = [];
// TODO: Удалить this._languages.
/**
* Список языков для ноды. Уже почти не используется в связи с переходом на новый формат настроек.
* Будет удалено в будущих версиях.
* @type {String[]}
* @name Node.prototype._languages
* @deprecated
* @private
*/
this._languages = null;
/**
* Промис на регистрацию всех таргетов для добавленных технологий.
* @type {Promise}
* @name Node.prototype._registerTargetsPromise
* @private
*/
this._registerTargetsPromise = null;
/**
* Построитель графа сборки.
* @type {BuildGraph}
* @name Node.prototype._graph
* @private
*/
this._graph = null;
},
/**
* Внутреннее состояние текущей сборки. Используется для обмена данными между нодами.
* @param {Object} buildState
*/
Function (anonymous_398)
✗ Was not called
setBuildState: function (buildState) {···
this.buildState = buildState;
},
setBuildState: function (buildState) {
this.buildState = buildState;
},
/**
* Устанавливает логгер для ноды (для того, чтобы логгировать ход сборки в консоль).
* @param {Logger} logger
* @returns {Node}
*/
Function (anonymous_399)
✗ Was not called
setLogger: function (logger) {···
this._logger = logger;
return this;
},
setLogger: function (logger) {
this._logger = logger;
return this;
},
/**
* Возвращает логгер для ноды. Технологии могут пользоваться этим методов для дополнительного логгирования.
* @returns {Logger}
*/
Function (anonymous_400)
✗ Was not called
getLogger: function () {···
return this._logger;
},
getLogger: function () {
return this._logger;
},
/**
* Устанавливает языки для ноды.
* @param {String[]} languages
* @returns {Node}
*/
Function (anonymous_401)
✗ Was not called
setLanguages: function (languages) {···
this._languages = languages;
return this;
},
setLanguages: function (languages) {
this._languages = languages;
return this;
},
/**
* Возвращает языки для текущей ноды.
* @returns {String[]}
*/
Function (anonymous_402)
✗ Was not called
getLanguages: function () {···
return this._languages;
},
getLanguages: function () {
return this._languages;
},
/**
* Возвращает абсолютный путь к директории с нодой.
* @returns {String}
*/
Function (anonymous_403)
✗ Was not called
getDir: function () {···
return this._dirname;
},
getDir: function () {
return this._dirname;
},
/**
* Возвращает абсолютный путь к директории с проектом.
* @returns {String}
*/
Function (anonymous_404)
✗ Was not called
getRootDir: function () {···
return this._root;
},
getRootDir: function () {
return this._root;
},
/**
* Возвращает относительный путь к директории с нодой (от корня проекта).
* @returns {*}
*/
Function (anonymous_405)
✗ Was not called
getPath: function () {···
return this._path;
},
getPath: function () {
return this._path;
},
/**
* Возвращает технологии, зарегистрированные для данной ноды.
* @returns {Tech[]}
*/
Function (anonymous_406)
✗ Was not called
getTechs: function () {···
return this._techs;
},
getTechs: function () {
return this._techs;
},
/**
* Устанавливает технологии для ноды.
* @param {Tech[]} techs
*/
Function (anonymous_407)
✗ Was not called
setTechs: function (techs) {···
this._techs = techs;
},
setTechs: function (techs) {
this._techs = techs;
},
/**
* Устанавливает таргеты для сборки.
* @param {String[]} targetsToBuild
*/
Function (anonymous_408)
✗ Was not called
setTargetsToBuild: function (targetsToBuild) {···
this._targetNamesToBuild = targetsToBuild;
},
setTargetsToBuild: function (targetsToBuild) {
this._targetNamesToBuild = targetsToBuild;
},
/**
* Устанавливает таргеты для удаления.
* @param {String[]} targetsToClean
*/
Function (anonymous_409)
✗ Was not called
setTargetsToClean: function (targetsToClean) {···
this._targetNamesToClean = targetsToClean;
},
setTargetsToClean: function (targetsToClean) {
this._targetNamesToClean = targetsToClean;
},
/**
* Устанавливает построитель графа сборки.
* @param {BuildGraph} graph
* @returns {Node}
*/
Function (anonymous_410)
✗ Was not called
setBuildGraph: function (graph) {···
this._graph = graph;
return this;
},
setBuildGraph: function (graph) {
this._graph = graph;
return this;
},
/**
* Возвращает абсолютный путь к файлу, лежащему в директории с нодой.
* @param {String} filename
* @returns {String}
*/
Function (anonymous_411)
✗ Was not called
resolvePath: function (filename) {···
return this._dirname + '/' + filename;
},
resolvePath: function (filename) {
return this._dirname + '/' + filename;
},
/**
* Возвращает абсолютный путь к файлу, лежащему в директории с указанной нодой.
* @param {String} nodePath Имя ноды (например, "pages/index").
* @param {String} filename
* @returns {String}
*/
Function (anonymous_412)
✗ Was not called
resolveNodePath: function (nodePath, filename) {···
return this._root + '/' + nodePath + '/' + filename;
},
resolveNodePath: function (nodePath, filename) {
return this._root + '/' + nodePath + '/' + filename;
},
/**
* Демаскирует имя таргета для указанной ноды. Например, для ноды "pages/index" заменяет "?.js" на "index.js".
* @param {String} nodePath Например, "pages/login".
* @param {String} targetName
* @returns {String}
*/
Function (anonymous_413)
✗ Was not called
unmaskNodeTargetName: function (nodePath, targetName) {···
return targetName.replace(/\?/g, path.basename(nodePath));
},
unmaskNodeTargetName: function (nodePath, targetName) {
return targetName.replace(/\?/g, path.basename(nodePath));
},
/**
* Возвращает относительный ноды путь к файлу (заданному абсолютным путем).
* @param {String} filename
* @returns {String}
*/
Function (anonymous_414)
✗ Was not called
relativePath: function (filename) {···
var res = path.relative(path.join(this._root, this._path), filename);
if (~res.indexOf('\\')) {
res = res.replace(/\\/g, '/');
}
if (res.charAt(0) !== '.') {
res = './' + res;
}
return res;
},
relativePath: function (filename) {
var res = path.relative(path.join(this._root, this._path), filename);
Branch IfStatement
✗ Positive was not executed (if)
if (~res.indexOf('\\')) {···
res = res.replace(/\\/g, '/');
}
✗ Negative was not executed (else)
}···
if (res.charAt(0) !== '.') {
if (~res.indexOf('\\')) {
res = res.replace(/\\/g, '/');
}
Branch IfStatement
✗ Positive was not executed (if)
if (res.charAt(0) !== '.') {···
res = './' + res;
}
✗ Negative was not executed (else)
}···
return res;
if (res.charAt(0) !== '.') {
res = './' + res;
}
return res;
},
/**
* Возвращает www-путь к файлу (заданному абсолютным путем).
* @param {String} filename
* @param {String} wwwRoot Адрес соответствующий корню проекта.
* @returns {String}
*/
Function (anonymous_415)
✗ Was not called
wwwRootPath: function (filename, wwwRoot) {···
wwwRoot = wwwRoot || '/';
return wwwRoot + path.relative(this._root, filename);
},
wwwRootPath: function (filename, wwwRoot) {
Branch LogicalExpression
✗ Was not returned
wwwRoot = wwwRoot || '/';
✗ Was not returned
wwwRoot = wwwRoot || '/';
wwwRoot = wwwRoot || '/';
return wwwRoot + path.relative(this._root, filename);
},
/**
* Удаляет файл, лежащий в директории ноды. Вспомогательный метод для технологий.
* @param {String} target
*/
Function (anonymous_416)
✗ Was not called
cleanTargetFile: function (target) {···
var targetPath = this.resolvePath(target);
if (fs.existsSync(targetPath)) {
fs.unlinkSync(targetPath);
this.getLogger().logClean(target);
}
},
cleanTargetFile: function (target) {
var targetPath = this.resolvePath(target);
Branch IfStatement
✗ Positive was not executed (if)
if (fs.existsSync(targetPath)) {···
fs.unlinkSync(targetPath);
this.getLogger().logClean(target);
}
✗ Negative was not executed (else)
}···
},
if (fs.existsSync(targetPath)) {
fs.unlinkSync(targetPath);
this.getLogger().logClean(target);
}
},
/**
* Создает временный файл для указанного таргета.
* @param {String} targetName
* @returns {String}
*/
Function (anonymous_417)
✗ Was not called
createTmpFileForTarget: function (targetName) {···
var dir = this._dirname;
function createTmpFilename() {
var prefix = '_tmp_' + (new Date()).getTime() + (Math.random() * 0x1000000000).toString(36) + '_';
var filename = dir + '/' + prefix + targetName;
return vowFs.exists(filename).then(function (exists) {
if (exists) {
return createTmpFilename();
} else {
return vowFs.write(filename, '').then(function () {
return filename;
});
}
});
}
return createTmpFilename();
},
createTmpFileForTarget: function (targetName) {
var dir = this._dirname;
Function createTmpFilename
✗ Was not called
function createTmpFilename() {···
var prefix = '_tmp_' + (new Date()).getTime() + (Math.random() * 0x1000000000).toString(36) + '_';
var filename = dir + '/' + prefix + targetName;
return vowFs.exists(filename).then(function (exists) {
if (exists) {
return createTmpFilename();
} else {
return vowFs.write(filename, '').then(function () {
return filename;
});
}
});
}
function createTmpFilename() {
var prefix = '_tmp_' + (new Date()).getTime() + (Math.random() * 0x1000000000).toString(36) + '_';
var filename = dir + '/' + prefix + targetName;
Function (anonymous_419)
✗ Was not called
return vowFs.exists(filename).then(function (exists) {···
if (exists) {
return createTmpFilename();
} else {
return vowFs.write(filename, '').then(function () {
return filename;
});
}
});
return vowFs.exists(filename).then(function (exists) {
Branch IfStatement
✗ Positive was not executed (if)
if (exists) {···
return createTmpFilename();
} else {
✗ Negative was not executed (else)
} else {···
return vowFs.write(filename, '').then(function () {
return filename;
});
}
if (exists) {
return createTmpFilename();
} else {
Function (anonymous_420)
✗ Was not called
return vowFs.write(filename, '').then(function () {···
return filename;
});
return vowFs.write(filename, '').then(function () {
return filename;
});
}
});
}
return createTmpFilename();
},
/**
* Инициализирует технологии, зарегистрированные в рамках ноды.
* @returns {Promise}
*/
Function (anonymous_421)
✗ Was not called
loadTechs: function () {···
var _this = this;
return Vow.all(this._techs.map(function (t) {
var nodeMirrorClass = function () {};
nodeMirrorClass.prototype = _this;
var mirror = new nodeMirrorClass();
return Vow.when(t.init(mirror)).then(function () {
return Vow.when(t.getTargets()).then(function (targets) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
var origRequireSources = _this.requireSources;
var origRequireNodeSources = _this.requireNodeSources;
mirror.requireSources = function (sources) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
mirror.requireNodeSources = function (sources) {
if (_this._graph) {
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
});
});
}));
},
loadTechs: function () {
var _this = this;
Function (anonymous_422)
✗ Was not called
return Vow.all(this._techs.map(function (t) {···
var nodeMirrorClass = function () {};
nodeMirrorClass.prototype = _this;
var mirror = new nodeMirrorClass();
return Vow.when(t.init(mirror)).then(function () {
return Vow.when(t.getTargets()).then(function (targets) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
var origRequireSources = _this.requireSources;
var origRequireNodeSources = _this.requireNodeSources;
mirror.requireSources = function (sources) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
mirror.requireNodeSources = function (sources) {
if (_this._graph) {
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
});
});
}));
return Vow.all(this._techs.map(function (t) {
Function (anonymous_423)
✗ Was not called
var nodeMirrorClass = function () {};
var nodeMirrorClass = function () {};
nodeMirrorClass.prototype = _this;
var mirror = new nodeMirrorClass();
Function (anonymous_424)
✗ Was not called
return Vow.when(t.init(mirror)).then(function () {···
return Vow.when(t.getTargets()).then(function (targets) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
var origRequireSources = _this.requireSources;
var origRequireNodeSources = _this.requireNodeSources;
mirror.requireSources = function (sources) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
mirror.requireNodeSources = function (sources) {
if (_this._graph) {
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
});
});
return Vow.when(t.init(mirror)).then(function () {
Function (anonymous_425)
✗ Was not called
return Vow.when(t.getTargets()).then(function (targets) {···
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
var origRequireSources = _this.requireSources;
var origRequireNodeSources = _this.requireNodeSources;
mirror.requireSources = function (sources) {
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
mirror.requireNodeSources = function (sources) {
if (_this._graph) {
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
});
return Vow.when(t.getTargets()).then(function (targets) {
Branch IfStatement
✗ Positive was not executed (if)
if (_this._graph) {···
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
✗ Negative was not executed (else)
}···
var origRequireSources = _this.requireSources;
if (_this._graph) {
Function (anonymous_426)
✗ Was not called
targets.forEach(function (target) {···
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
_this._graph.addTarget(targetPath, t.getName());
});
}
var origRequireSources = _this.requireSources;
var origRequireNodeSources = _this.requireNodeSources;
Function (anonymous_427)
✗ Was not called
mirror.requireSources = function (sources) {···
if (_this._graph) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
mirror.requireSources = function (sources) {
Branch IfStatement
✗ Positive was not executed (if)
if (_this._graph) {···
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
✗ Negative was not executed (else)
}···
return origRequireSources.apply(_this, arguments);
if (_this._graph) {
Function (anonymous_428)
✗ Was not called
targets.forEach(function (target) {···
var targetPath = _this._path + '/' + target;
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
Function (anonymous_429)
✗ Was not called
sources.forEach(function (source) {···
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
sources.forEach(function (source) {
_this._graph.addDep(targetPath, _this._path + '/' + _this.unmaskTargetName(source));
});
});
}
return origRequireSources.apply(_this, arguments);
};
Function (anonymous_430)
✗ Was not called
mirror.requireNodeSources = function (sources) {···
if (_this._graph) {
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
mirror.requireNodeSources = function (sources) {
Branch IfStatement
✗ Positive was not executed (if)
if (_this._graph) {···
Object.keys(sources).forEach(function (nodeName) {
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
✗ Negative was not executed (else)
}···
return origRequireNodeSources.apply(_this, arguments);
if (_this._graph) {
Function (anonymous_431)
✗ Was not called
Object.keys(sources).forEach(function (nodeName) {···
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
Object.keys(sources).forEach(function (nodeName) {
Function (anonymous_432)
✗ Was not called
targets.forEach(function (target) {···
var targetPath = _this._path + '/' + target;
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
targets.forEach(function (target) {
var targetPath = _this._path + '/' + target;
Function (anonymous_433)
✗ Was not called
sources[nodeName].forEach(function (source) {···
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
sources[nodeName].forEach(function (source) {
_this._graph.addDep(
targetPath, nodeName + '/' + _this.unmaskNodeTargetName(nodeName, source)
);
});
});
});
}
return origRequireNodeSources.apply(_this, arguments);
};
});
});
}));
},
/**
* Возвращает техническую информацию об указанном таргете.
* Формат результата: { tech: <ссылка на технологию>, started: true|false, promise: <промис на выполнение> }
* @param {String} name Имя таргета.
* @returns {Object}
* @private
*/
Function (anonymous_434)
✗ Was not called
_getTarget: function (name) {···
var targets = this._targetNames;
var target;
if (!(target = targets[name])) {
target = targets[name] = {started: false};
}
if (!target.promise) {
target.promise = Vow.promise();
}
return target;
},
_getTarget: function (name) {
var targets = this._targetNames;
var target;
Branch IfStatement
✗ Positive was not executed (if)
if (!(target = targets[name])) {···
target = targets[name] = {started: false};
}
✗ Negative was not executed (else)
}···
if (!target.promise) {
if (!(target = targets[name])) {
target = targets[name] = {started: false};
}
Branch IfStatement
✗ Positive was not executed (if)
if (!target.promise) {···
target.promise = Vow.promise();
}
✗ Negative was not executed (else)
}···
return target;
if (!target.promise) {
target.promise = Vow.promise();
}
return target;
},
/**
* Возвращает true, если таргет под указанным именем может быть собран. В противном случае возвращает false.
* @param {String} name
* @returns {Boolean}
*/
Function (anonymous_435)
✗ Was not called
hasRegisteredTarget: function (name) {···
return !!this._targetNames[name];
},
hasRegisteredTarget: function (name) {
return !!this._targetNames[name];
},
/**
* Возвращает базовое имя таргета по умолчанию для ноды. Например, "index" для "pages/index".
* Добавляет суффикс если не обходимо. Например, для "pages/index": node.getTargetName("js") -> index.js
* @param {String} suffix
* @returns {String}
*/
Function (anonymous_436)
✗ Was not called
getTargetName: function (suffix) {···
return this._targetName + (suffix ? '.' + suffix : '');
},
getTargetName: function (suffix) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return this._targetName + (suffix ? '.' + suffix : '');
✗ Negative was not returned (: ...)
return this._targetName + (suffix ? '.' + suffix : '');
return this._targetName + (suffix ? '.' + suffix : '');
},
/**
* Демаскирует имя таргета. Например, для ноды "pages/index" заменяет "?.js" на "index.js".
* @param {String} targetName
* @returns {String}
*/
Function (anonymous_437)
✗ Was not called
unmaskTargetName: function (targetName) {···
return targetName.replace(/\?/g, this._targetName);
},
unmaskTargetName: function (targetName) {
return targetName.replace(/\?/g, this._targetName);
},
/**
* Регистрирует таргет для указанной технологии.
* @param {String} target
* @param {Tech} tech
* @private
*/
Function (anonymous_438)
✗ Was not called
_registerTarget: function (target, tech) {···
var targetObj = this._getTarget(target);
if (targetObj.tech) {
throw Error(
'Concurrent techs for target: ' + target + ', techs: "' + targetObj.tech.getName() +
'" vs "' + tech.getName() + '"'
);
}
targetObj.tech = tech;
},
_registerTarget: function (target, tech) {
var targetObj = this._getTarget(target);
Branch IfStatement
✗ Positive was not executed (if)
if (targetObj.tech) {···
throw Error(
'Concurrent techs for target: ' + target + ', techs: "' + targetObj.tech.getName() +
'" vs "' + tech.getName() + '"'
);
}
✗ Negative was not executed (else)
}···
targetObj.tech = tech;
if (targetObj.tech) {
throw Error(
'Concurrent techs for target: ' + target + ', techs: "' + targetObj.tech.getName() +
'" vs "' + tech.getName() + '"'
);
}
targetObj.tech = tech;
},
/**
* Оповещает ноду о том, что таргет собран. Технологии, которые зависят от этого таргета могут продолжить работу.
* @param {String} target
* @param {Object} [value]
* @returns {Promise}
*/
Function (anonymous_439)
✗ Was not called
resolveTarget: function (target, value) {···
var targetObj = this._getTarget(target);
if (!targetObj.isValid) {
this._logger.logAction('rebuild', target, targetObj.tech.getName());
}
if (this._graph) {
this._graph.resolveTarget(this._path + '/' + target);
}
return targetObj.promise.fulfill(value);
},
resolveTarget: function (target, value) {
var targetObj = this._getTarget(target);
Branch IfStatement
✗ Positive was not executed (if)
if (!targetObj.isValid) {···
this._logger.logAction('rebuild', target, targetObj.tech.getName());
}
✗ Negative was not executed (else)
}···
if (this._graph) {
if (!targetObj.isValid) {
this._logger.logAction('rebuild', target, targetObj.tech.getName());
}
Branch IfStatement
✗ Positive was not executed (if)
if (this._graph) {···
this._graph.resolveTarget(this._path + '/' + target);
}
✗ Negative was not executed (else)
}···
return targetObj.promise.fulfill(value);
if (this._graph) {
this._graph.resolveTarget(this._path + '/' + target);
}
return targetObj.promise.fulfill(value);
},
/**
* Вывод сообщение в лог о том, что таргет не был пересобран, т.к. в этом нет нужды.
* @param {String} target
*/
Function (anonymous_440)
✗ Was not called
isValidTarget: function (target) {···
var targetObj = this._getTarget(target);
this._logger.isValid(target, targetObj.tech.getName());
targetObj.isValid = true;
},
isValidTarget: function (target) {
var targetObj = this._getTarget(target);
this._logger.isValid(target, targetObj.tech.getName());
targetObj.isValid = true;
},
/**
* Оповещает ноду о том, что таргет не удалось собрать. В этот метод следует передать ошибку.
* @param {String} target
* @param {Error} err
* @returns {Promise}
*/
Function (anonymous_441)
✗ Was not called
rejectTarget: function (target, err) {···
var targetObj = this._getTarget(target);
this._logger.logErrorAction('failed', target, targetObj.tech.getName());
return targetObj.promise.reject(err);
},
rejectTarget: function (target, err) {
var targetObj = this._getTarget(target);
this._logger.logErrorAction('failed', target, targetObj.tech.getName());
return targetObj.promise.reject(err);
},
/**
* Требует выполнения таргетов для переданных нод.
* Требование в формате: { "node/path": [ "target1", "target2", ... ], "another-node/path": ... }.
* @param {Object} sourcesByNodes
* @returns {Promise}
*/
Function (anonymous_442)
✗ Was not called
requireNodeSources: function (sourcesByNodes) {···
var _this = this;
var resultByNodes = {};
return Vow.all(Object.keys(sourcesByNodes).map(function (nodePath) {
return _this._makePlatform.requireNodeSources(nodePath, sourcesByNodes[nodePath]).then(function (results) {
resultByNodes[nodePath] = results;
});
})).then(function () {
return resultByNodes;
});
},
requireNodeSources: function (sourcesByNodes) {
var _this = this;
var resultByNodes = {};
Function (anonymous_443)
✗ Was not called
return Vow.all(Object.keys(sourcesByNodes).map(function (nodePath) {···
return _this._makePlatform.requireNodeSources(nodePath, sourcesByNodes[nodePath]).then(function (results) {
resultByNodes[nodePath] = results;
});
})).then(function () {
return Vow.all(Object.keys(sourcesByNodes).map(function (nodePath) {
Function (anonymous_444)
✗ Was not called
return _this._makePlatform.requireNodeSources(nodePath, sourcesByNodes[nodePath]).then(function (results) {···
resultByNodes[nodePath] = results;
});
return _this._makePlatform.requireNodeSources(nodePath, sourcesByNodes[nodePath]).then(function (results) {
resultByNodes[nodePath] = results;
});
Function (anonymous_445)
✗ Was not called
})).then(function () {···
return resultByNodes;
});
})).then(function () {
return resultByNodes;
});
},
/**
* Требует выполнения таргетов.
* Требование в формате: ["target1", "target2", ...].
* Например, node.requireSources(["index.js"]).then(...);
* @param {String[]} sources
* @returns {Promise}
*/
Function (anonymous_446)
✗ Was not called
requireSources: function (sources) {···
var _this = this;
return this._registerTargets().then(function () {
return Vow.all(sources.map(function (source) {
source = _this.unmaskTargetName(source);
var targetObj = _this._getTarget(source);
if (!targetObj.tech) {
throw TargetNotFoundEror('There is no tech for target ' + _this._path + '/' + source + '.');
}
if (!targetObj.started) {
targetObj.started = true;
if (!targetObj.tech.__started) {
targetObj.tech.__started = true;
try {
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
}
return targetObj.promise;
}));
});
},
requireSources: function (sources) {
var _this = this;
Function (anonymous_447)
✗ Was not called
return this._registerTargets().then(function () {···
return Vow.all(sources.map(function (source) {
source = _this.unmaskTargetName(source);
var targetObj = _this._getTarget(source);
if (!targetObj.tech) {
throw TargetNotFoundEror('There is no tech for target ' + _this._path + '/' + source + '.');
}
if (!targetObj.started) {
targetObj.started = true;
if (!targetObj.tech.__started) {
targetObj.tech.__started = true;
try {
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
}
return targetObj.promise;
}));
});
return this._registerTargets().then(function () {
Function (anonymous_448)
✗ Was not called
return Vow.all(sources.map(function (source) {···
source = _this.unmaskTargetName(source);
var targetObj = _this._getTarget(source);
if (!targetObj.tech) {
throw TargetNotFoundEror('There is no tech for target ' + _this._path + '/' + source + '.');
}
if (!targetObj.started) {
targetObj.started = true;
if (!targetObj.tech.__started) {
targetObj.tech.__started = true;
try {
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
}
return targetObj.promise;
}));
return Vow.all(sources.map(function (source) {
source = _this.unmaskTargetName(source);
var targetObj = _this._getTarget(source);
Branch IfStatement
✗ Positive was not executed (if)
if (!targetObj.tech) {···
throw TargetNotFoundEror('There is no tech for target ' + _this._path + '/' + source + '.');
}
✗ Negative was not executed (else)
}···
if (!targetObj.started) {
if (!targetObj.tech) {
throw TargetNotFoundEror('There is no tech for target ' + _this._path + '/' + source + '.');
}
Branch IfStatement
✗ Positive was not executed (if)
if (!targetObj.started) {···
targetObj.started = true;
if (!targetObj.tech.__started) {
targetObj.tech.__started = true;
try {
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
}
✗ Negative was not executed (else)
}···
return targetObj.promise;
if (!targetObj.started) {
targetObj.started = true;
Branch IfStatement
✗ Positive was not executed (if)
if (!targetObj.tech.__started) {···
targetObj.tech.__started = true;
try {
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
✗ Negative was not executed (else)
}···
}
if (!targetObj.tech.__started) {
targetObj.tech.__started = true;
try {
Function (anonymous_449)
✗ Was not called
Vow.when(targetObj.tech.build()).fail(function (err) {···
_this.rejectTarget(source, err);
});
Vow.when(targetObj.tech.build()).fail(function (err) {
_this.rejectTarget(source, err);
});
} catch (err) {
_this.rejectTarget(source, err);
}
}
}
return targetObj.promise;
}));
});
},
/**
* Удаляет таргеты с помощью технологий.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_450)
✗ Was not called
cleanTargets: function (targets) {···
var _this = this;
return Vow.all(targets.map(function (target) {
var targetObj = _this._getTarget(target);
if (!targetObj.tech) {
throw Error('There is no tech for target ' + target + '.');
}
return Vow.when(targetObj.tech.clean());
}));
},
cleanTargets: function (targets) {
var _this = this;
Function (anonymous_451)
✗ Was not called
return Vow.all(targets.map(function (target) {···
var targetObj = _this._getTarget(target);
if (!targetObj.tech) {
throw Error('There is no tech for target ' + target + '.');
}
return Vow.when(targetObj.tech.clean());
}));
return Vow.all(targets.map(function (target) {
var targetObj = _this._getTarget(target);
Branch IfStatement
✗ Positive was not executed (if)
if (!targetObj.tech) {···
throw Error('There is no tech for target ' + target + '.');
}
✗ Negative was not executed (else)
}···
return Vow.when(targetObj.tech.clean());
if (!targetObj.tech) {
throw Error('There is no tech for target ' + target + '.');
}
return Vow.when(targetObj.tech.clean());
}));
},
/**
* Регистрирует таргеты по имеющимся технологиям.
* Часть инициализации ноды.
* @returns {Promise}
* @private
*/
Function (anonymous_452)
✗ Was not called
_registerTargets: function () {···
var _this = this;
if (!this._registerTargetsPromise) {
this._registerTargetsPromise = Vow.all(this._techs.map(function (t) {
return t.getTargets();
})).then(function (targetLists) {
function registerTarget(targetName) {
_this._registerTarget(targetName, _this._techs[i]);
}
for (var i = 0, l = _this._techs.length; i < l; i++) {
targetLists[i].forEach(registerTarget);
}
});
}
return this._registerTargetsPromise;
},
_registerTargets: function () {
var _this = this;
Branch IfStatement
✗ Positive was not executed (if)
if (!this._registerTargetsPromise) {···
this._registerTargetsPromise = Vow.all(this._techs.map(function (t) {
return t.getTargets();
})).then(function (targetLists) {
function registerTarget(targetName) {
_this._registerTarget(targetName, _this._techs[i]);
}
for (var i = 0, l = _this._techs.length; i < l; i++) {
targetLists[i].forEach(registerTarget);
}
});
}
✗ Negative was not executed (else)
}···
return this._registerTargetsPromise;
if (!this._registerTargetsPromise) {
Function (anonymous_453)
✗ Was not called
this._registerTargetsPromise = Vow.all(this._techs.map(function (t) {···
return t.getTargets();
})).then(function (targetLists) {
this._registerTargetsPromise = Vow.all(this._techs.map(function (t) {
return t.getTargets();
Function (anonymous_454)
✗ Was not called
})).then(function (targetLists) {···
function registerTarget(targetName) {
_this._registerTarget(targetName, _this._techs[i]);
}
for (var i = 0, l = _this._techs.length; i < l; i++) {
targetLists[i].forEach(registerTarget);
}
});
})).then(function (targetLists) {
Function registerTarget
✗ Was not called
function registerTarget(targetName) {···
_this._registerTarget(targetName, _this._techs[i]);
}
function registerTarget(targetName) {
_this._registerTarget(targetName, _this._techs[i]);
}
for (var i = 0, l = _this._techs.length; i < l; i++) {
targetLists[i].forEach(registerTarget);
}
});
}
return this._registerTargetsPromise;
},
/**
* Вычисляет список имен таргетов по переданным данным.
* @param {String[]} targets Список целей (указанный в настройках сборки, например).
* @param {String[]} defaultTargetList Полный список целей (для случая, когда указана маска "*").
* @returns {String[]}
* @private
*/
Function (anonymous_456)
✗ Was not called
_resolveTargets: function (targets, defaultTargetList) {···
var targetsToBuild = this._targetNamesToBuild;
var _this = this;
if (targets) {
targetsToBuild = targets;
targetsToBuild = [].concat.apply([], targetsToBuild.map(function (targetName) {
if (targetName === '*') {
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
} else {
return [targetName];
}
}));
}
if (!targetsToBuild) {
targetsToBuild = Object.keys(this._targetNames);
}
targetsToBuild = targetsToBuild.filter(function (elem, pos) {
return targetsToBuild.indexOf(elem) === pos;
});
return targetsToBuild;
},
_resolveTargets: function (targets, defaultTargetList) {
var targetsToBuild = this._targetNamesToBuild;
var _this = this;
Branch IfStatement
✗ Positive was not executed (if)
if (targets) {···
targetsToBuild = targets;
targetsToBuild = [].concat.apply([], targetsToBuild.map(function (targetName) {
if (targetName === '*') {
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
} else {
return [targetName];
}
}));
}
✗ Negative was not executed (else)
}···
if (!targetsToBuild) {
if (targets) {
targetsToBuild = targets;
Function (anonymous_457)
✗ Was not called
targetsToBuild = [].concat.apply([], targetsToBuild.map(function (targetName) {···
if (targetName === '*') {
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
} else {
return [targetName];
}
}));
targetsToBuild = [].concat.apply([], targetsToBuild.map(function (targetName) {
Branch IfStatement
✗ Positive was not executed (if)
if (targetName === '*') {···
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
} else {
✗ Negative was not executed (else)
} else {···
return [targetName];
}
if (targetName === '*') {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
✗ Negative was not returned (: ...)
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
return (defaultTargetList.length ? defaultTargetList : Object.keys(_this._targetNames));
} else {
return [targetName];
}
}));
}
Branch IfStatement
✗ Positive was not executed (if)
if (!targetsToBuild) {···
targetsToBuild = Object.keys(this._targetNames);
}
✗ Negative was not executed (else)
}···
targetsToBuild = targetsToBuild.filter(function (elem, pos) {
if (!targetsToBuild) {
targetsToBuild = Object.keys(this._targetNames);
}
Function (anonymous_458)
✗ Was not called
targetsToBuild = targetsToBuild.filter(function (elem, pos) {···
return targetsToBuild.indexOf(elem) === pos;
});
targetsToBuild = targetsToBuild.filter(function (elem, pos) {
return targetsToBuild.indexOf(elem) === pos;
});
return targetsToBuild;
},
/**
* Запускает сборку указанных целей для ноды.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_459)
✗ Was not called
build: function (targets) {···
var _this = this;
var targetsToBuild = _this._resolveTargets(targets, _this._targetNamesToBuild);
return this.requireSources(targetsToBuild)
.then(function () {
return {
builtTargets: targetsToBuild.map(function (target) {
return path.join(_this._path, target);
})
};
});
},
build: function (targets) {
var _this = this;
var targetsToBuild = _this._resolveTargets(targets, _this._targetNamesToBuild);
return this.requireSources(targetsToBuild)
Function (anonymous_460)
✗ Was not called
.then(function () {···
return {
builtTargets: targetsToBuild.map(function (target) {
return path.join(_this._path, target);
})
};
});
.then(function () {
return {
Function (anonymous_461)
✗ Was not called
builtTargets: targetsToBuild.map(function (target) {···
return path.join(_this._path, target);
})
builtTargets: targetsToBuild.map(function (target) {
return path.join(_this._path, target);
})
};
});
},
// TODO: Удалить параметр buildCache.
/**
* Запускает удаление указанных целей для ноды.
* @param {String[]} targets
* @param {Object} buildCache Вроде, лишний параметр, надо удалить.
* @returns {Promise}
*/
Function (anonymous_462)
✗ Was not called
clean: function (targets, buildCache) {···
var _this = this;
this.buildState = buildCache || {};
return this._registerTargets().then(function () {
return _this.cleanTargets(_this._resolveTargets(targets, _this._targetNamesToClean));
});
},
clean: function (targets, buildCache) {
var _this = this;
Branch LogicalExpression
✗ Was not returned
this.buildState = buildCache || {};
✗ Was not returned
this.buildState = buildCache || {};
this.buildState = buildCache || {};
Function (anonymous_463)
✗ Was not called
return this._registerTargets().then(function () {···
return _this.cleanTargets(_this._resolveTargets(targets, _this._targetNamesToClean));
});
return this._registerTargets().then(function () {
return _this.cleanTargets(_this._resolveTargets(targets, _this._targetNamesToClean));
});
},
/**
* Возвращает кэш для таргета ноды. Этим методом могут пользоваться технологии для кэширования.
* @param {String} subCacheName
* @returns {Cache}
*/
Function (anonymous_464)
✗ Was not called
getNodeCache: function (subCacheName) {···
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
},
getNodeCache: function (subCacheName) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
✗ Negative was not returned (: ...)
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
},
/**
* Возвращает схему именования для уровня переопределения.
* Схема именования содержит два метода:
* ```javascript
* // Выполняет построение структуры файлов уровня переопределения, используя методы инстанции класса LevelBuilder.
* {Promise} buildLevel( {String} levelPath, {LevelBuilder} levelBuilder )
* // Возвращает путь к файлу на основе пути к уровню переопределения и BEM-описания.
* {String} buildFilePath(
* {String} levelPath, {String} blockName, {String} elemName, {String} modName, {String} modVal
* )
* ```
* @returns {Object|undefined}
*/
Function (anonymous_465)
✗ Was not called
getLevelNamingScheme: function (levelPath) {···
return this._makePlatform.getLevelNamingScheme(levelPath);
},
getLevelNamingScheme: function (levelPath) {
return this._makePlatform.getLevelNamingScheme(levelPath);
},
Function (anonymous_466)
✗ Was not called
destruct: function () {···
delete this._makePlatform;
this._nodeCache.destruct();
delete this._nodeCache;
delete this._techs;
delete this._graph;
}
destruct: function () {
delete this._makePlatform;
this._nodeCache.destruct();
delete this._nodeCache;
delete this._techs;
delete this._graph;
}
});
target-not-found-error.js
/**
* TargetNotFoundError
* ===================
*
* TargetNotFoundError — класс ошибки, которую возвращает ENB-платформа в случае, когда таргет не найден.
* Используется ENB-middleware для того, чтобы передать запрос следующим express-обработчикам.
*
* @constructor
*/
Function TargetNotFoundError
✗ Was not called
function TargetNotFoundError() {···
var error = Error.apply(this, arguments);
error.constructor = TargetNotFoundError;
/*jshint proto:true */
error.__proto__ = TargetNotFoundError.prototype;
return error;
}
function TargetNotFoundError() {
var error = Error.apply(this, arguments);
error.constructor = TargetNotFoundError;
/*jshint proto:true */
error.__proto__ = TargetNotFoundError.prototype;
return error;
}
module.exports = TargetNotFoundError;
/*jshint proto:true */
TargetNotFoundError.prototype.__proto__ = Error.prototype;
logger.js
/**
* Logger
* ======
*/
var colors = require('./ui/colorize');
var inherit = require('inherit');
/**
* Логгер. В данной реализации — обертка над console.log.
* Выводит в консоль процесс сборки проекта.
* @name Logger
*/
var Logger = module.exports = inherit( /** @lends Logger.prototype */ {
/**
* Конструктор.
* На основе одного логгера можно создать вложенный логгер с помощью аргумента scope.
* Если указан scope, то scope будет выводиться при логгировании.
* @param {String} scope
* @param {Object} options
* @private
*/
Function (anonymous_468)
✗ Was not called
__constructor: function (scope, options) {···
this._scope = scope || '';
this._enabled = true;
this._options = options || {};
},
__constructor: function (scope, options) {
Branch LogicalExpression
✗ Was not returned
this._scope = scope || '';
✗ Was not returned
this._scope = scope || '';
this._scope = scope || '';
this._enabled = true;
Branch LogicalExpression
✗ Was not returned
this._options = options || {};
✗ Was not returned
this._options = options || {};
this._options = options || {};
},
/**
* Базовый метод для логгирования.
* @param {String} msg
* @param {String} [scope]
* @param {String} [action]
*/
Function (anonymous_469)
✗ Was not called
log: function (msg, scope, action) {···
scope = scope || this._scope;
action = action || '';
var dt = new Date();
if (this._enabled) {
console.log(
colors.grey(
zeros(dt.getHours(), 2) + ':' +
zeros(dt.getMinutes(), 2) + ':' +
zeros(dt.getSeconds(), 2) + '.' +
zeros(dt.getMilliseconds(), 3) + ' - '
) +
(action && action + ' ') +
(scope && ('[' +
colors.blue(
scope.replace(/(:.+)$/, function (s, g) {
return colors.magenta(g.substr(1));
})
) +
'] ')
) +
msg
);
}
},
log: function (msg, scope, action) {
Branch LogicalExpression
✗ Was not returned
scope = scope || this._scope;
✗ Was not returned
scope = scope || this._scope;
scope = scope || this._scope;
Branch LogicalExpression
✗ Was not returned
action = action || '';
✗ Was not returned
action = action || '';
action = action || '';
var dt = new Date();
Branch IfStatement
✗ Positive was not executed (if)
if (this._enabled) {···
console.log(
colors.grey(
zeros(dt.getHours(), 2) + ':' +
zeros(dt.getMinutes(), 2) + ':' +
zeros(dt.getSeconds(), 2) + '.' +
zeros(dt.getMilliseconds(), 3) + ' - '
) +
(action && action + ' ') +
(scope && ('[' +
colors.blue(
scope.replace(/(:.+)$/, function (s, g) {
return colors.magenta(g.substr(1));
})
) +
'] ')
) +
msg
);
}
✗ Negative was not executed (else)
}···
},
if (this._enabled) {
console.log(
colors.grey(
zeros(dt.getHours(), 2) + ':' +
zeros(dt.getMinutes(), 2) + ':' +
zeros(dt.getSeconds(), 2) + '.' +
zeros(dt.getMilliseconds(), 3) + ' - '
) +
Branch LogicalExpression
✗ Was not returned
(action && action + ' ') +
✗ Was not returned
(action && action + ' ') +
(action && action + ' ') +
Branch LogicalExpression
✗ Was not returned
(scope && ('[' +···
colors.blue(
scope.replace(/(:.+)$/, function (s, g) {
return colors.magenta(g.substr(1));
})
) +
'] ')
✗ Was not returned
(scope && ('[' +
(scope && ('[' +
colors.blue(
Function (anonymous_470)
✗ Was not called
scope.replace(/(:.+)$/, function (s, g) {···
return colors.magenta(g.substr(1));
})
scope.replace(/(:.+)$/, function (s, g) {
return colors.magenta(g.substr(1));
})
) +
'] ')
) +
msg
);
}
},
/**
* Оформляет запись в лог, как действие.
* @param {String} action
* @param {String} target
* @param {String} [additionalInfo]
*/
Function (anonymous_471)
✗ Was not called
logAction: function (action, target, additionalInfo) {···
this.log(
(additionalInfo ? colors.grey(additionalInfo) : ''),
(this._scope && (this._scope + '/')) + target,
'[' + colors.green(action) + ']'
);
},
logAction: function (action, target, additionalInfo) {
this.log(
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(additionalInfo ? colors.grey(additionalInfo) : ''),
✗ Negative was not returned (: ...)
(additionalInfo ? colors.grey(additionalInfo) : ''),
(additionalInfo ? colors.grey(additionalInfo) : ''),
Branch LogicalExpression
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
(this._scope && (this._scope + '/')) + target,
'[' + colors.green(action) + ']'
);
},
/**
* Выводит варнинг.
* @param {String} action
* @param {String} target
* @param {String} msg
*/
Function (anonymous_472)
✗ Was not called
logWarningAction: function (action, target, msg) {···
if (!this._options.hideWarnings) {
this.log(
msg,
(this._scope && (this._scope + '/')) + target,
'[' + colors.yellow(action) + ']'
);
}
},
logWarningAction: function (action, target, msg) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._options.hideWarnings) {···
this.log(
msg,
(this._scope && (this._scope + '/')) + target,
'[' + colors.yellow(action) + ']'
);
}
✗ Negative was not executed (else)
}···
},
if (!this._options.hideWarnings) {
this.log(
msg,
Branch LogicalExpression
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
(this._scope && (this._scope + '/')) + target,
'[' + colors.yellow(action) + ']'
);
}
},
/**
* @param {String} target
* @param {String} deprecatedTech
* @param {String} thisPackage
* @param {String} newTech
* @param {String} newPackage
* @param {String} [desc]
*/
Function (anonymous_473)
✗ Was not called
logTechIsDeprecated: function (target, deprecatedTech, thisPackage, newTech, newPackage, desc) {···
this.logWarningAction('deprecated',
target,
'Tech ' + colors.bold(thisPackage + '/techs/' + deprecatedTech) + ' is deprecated.' +
(newTech && newPackage ?
' ' +
(newPackage === thisPackage ?
'Use ' :
'Install package ' + colors.bold(newPackage) + ' and use '
) +
'tech ' + colors.bold(newPackage + '/techs/' + newTech) + ' instead.' :
''
) +
(desc || '')
);
},
logTechIsDeprecated: function (target, deprecatedTech, thisPackage, newTech, newPackage, desc) {
this.logWarningAction('deprecated',
target,
'Tech ' + colors.bold(thisPackage + '/techs/' + deprecatedTech) + ' is deprecated.' +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
' ' +···
(newPackage === thisPackage ?
'Use ' :
'Install package ' + colors.bold(newPackage) + ' and use '
) +
'tech ' + colors.bold(newPackage + '/techs/' + newTech) + ' instead.' :
✗ Negative was not returned (: ...)
''
Branch LogicalExpression
✗ Was not returned
(newTech && newPackage ?
✗ Was not returned
(newTech && newPackage ?
(newTech && newPackage ?
' ' +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
'Use ' :
✗ Negative was not returned (: ...)
'Install package ' + colors.bold(newPackage) + ' and use '
(newPackage === thisPackage ?
'Use ' :
'Install package ' + colors.bold(newPackage) + ' and use '
) +
'tech ' + colors.bold(newPackage + '/techs/' + newTech) + ' instead.' :
''
) +
Branch LogicalExpression
✗ Was not returned
(desc || '')
✗ Was not returned
(desc || '')
(desc || '')
);
},
/**
*
* @param {String} target
* @param {String} thisPackage
* @param {String} tech
* @param {String} thisOption
* @param {String} newOption
* @param desc
*/
Function (anonymous_474)
✗ Was not called
logOptionIsDeprecated: function (target, thisPackage, tech, thisOption, newOption, desc) {···
this.logWarningAction('deprecated',
target,
'Option ' + colors.bold(thisOption) + ' of ' + colors.bold(thisPackage + '/techs/' + tech) +
' is deprecated.' +
(newOption ? ' Use option ' + colors.bold(newOption) + ' instead.' : '') +
(desc || '')
);
},
logOptionIsDeprecated: function (target, thisPackage, tech, thisOption, newOption, desc) {
this.logWarningAction('deprecated',
target,
'Option ' + colors.bold(thisOption) + ' of ' + colors.bold(thisPackage + '/techs/' + tech) +
' is deprecated.' +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(newOption ? ' Use option ' + colors.bold(newOption) + ' instead.' : '') +
✗ Negative was not returned (: ...)
(newOption ? ' Use option ' + colors.bold(newOption) + ' instead.' : '') +
(newOption ? ' Use option ' + colors.bold(newOption) + ' instead.' : '') +
Branch LogicalExpression
✗ Was not returned
(desc || '')
✗ Was not returned
(desc || '')
(desc || '')
);
},
/**
* Выводит ошибку.
* @param {String} action
* @param {String} target
* @param {String} [additionalInfo]
*/
Function (anonymous_475)
✗ Was not called
logErrorAction: function (action, target, additionalInfo) {···
this.log(
(additionalInfo ? colors.grey(additionalInfo) : ''),
(this._scope && (this._scope + '/')) + target,
'[' + colors.red(action) + ']'
);
},
logErrorAction: function (action, target, additionalInfo) {
this.log(
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(additionalInfo ? colors.grey(additionalInfo) : ''),
✗ Negative was not returned (: ...)
(additionalInfo ? colors.grey(additionalInfo) : ''),
(additionalInfo ? colors.grey(additionalInfo) : ''),
Branch LogicalExpression
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
(this._scope && (this._scope + '/')) + target,
'[' + colors.red(action) + ']'
);
},
/**
* Выводит сообщение isValid
* (используется технологиями для показа сообщения о том, что таргет не нужно пересобирать).
* @param {String} target
* @param {String} [tech]
*/
Function (anonymous_476)
✗ Was not called
isValid: function (target, tech) {···
this.logAction('isValid', target, tech);
},
isValid: function (target, tech) {
this.logAction('isValid', target, tech);
},
/**
* Выводит сообщение clean (используется технологиями для показа сообщения о том, что таргет удален).
* @param {String} target
*/
Function (anonymous_477)
✗ Was not called
logClean: function (target) {···
this.logAction('clean', target);
},
logClean: function (target) {
this.logAction('clean', target);
},
/**
* Активирует/деактивирует логгер.
* С помощью этого метода можно отключить логгирование.
* @param {Boolean} enabled
*/
Function (anonymous_478)
✗ Was not called
setEnabled: function (enabled) {···
this._enabled = enabled;
},
setEnabled: function (enabled) {
this._enabled = enabled;
},
/**
* Возвращает активность логгера.
* @returns {Boolean}
*/
Function (anonymous_479)
✗ Was not called
isEnabled: function () {···
return this._enabled;
},
isEnabled: function () {
return this._enabled;
},
Function (anonymous_480)
✗ Was not called
hideWarnings: function () {···
this._options.hideWarnings = true;
},
hideWarnings: function () {
this._options.hideWarnings = true;
},
Function (anonymous_481)
✗ Was not called
showWarnings: function () {···
this._options.hideWarnings = false;
},
showWarnings: function () {
this._options.hideWarnings = false;
},
/**
* Возвращает новый логгер на основе scope текущего (складывая scope'ы).
* @param {String} scope
* @returns {Logger}
*/
Function (anonymous_482)
✗ Was not called
subLogger: function (scope) {···
var res = new Logger(
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
this._options
);
res.setEnabled(this._enabled);
return res;
}
subLogger: function (scope) {
var res = new Logger(
Branch ConditionalExpression
✗ Positive was not returned (? ...)
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
✗ Negative was not returned (: ...)
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
Branch LogicalExpression
✗ Was not returned
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
✗ Was not returned
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope),
this._options
);
res.setEnabled(this._enabled);
return res;
}
});
/**
* Добавляет ведущие нули.
* @param {String} s
* @param {Number} l
* @returns {String}
* @private
*/
Function zeros
✗ Was not called
function zeros(s, l) {···
s = '' + s;
while (s.length < l) {
s = '0' + s;
}
return s;
}
function zeros(s, l) {
s = '' + s;
while (s.length < l) {
s = '0' + s;
}
return s;
}
colorize.js
var tty = require('tty');
var styles = {
'bold': ['\033[1m', '\033[22m'],
'italic': ['\033[3m', '\033[23m'],
'underline': ['\033[4m', '\033[24m'],
'inverse': ['\033[7m', '\033[27m'],
'black': ['\033[30m', '\033[39m'],
'red': ['\033[31m', '\033[39m'],
'green': ['\033[32m', '\033[39m'],
'yellow': ['\033[33m', '\033[39m'],
'blue': ['\033[34m', '\033[39m'],
'magenta': ['\033[35m', '\033[39m'],
'cyan': ['\033[36m', '\033[39m'],
'white': ['\033[37m', '\033[39m'],
'default': ['\033[39m', '\033[39m'],
'grey': ['\033[90m', '\033[39m'],
'bgBlack': ['\033[40m', '\033[49m'],
'bgRed': ['\033[41m', '\033[49m'],
'bgGreen': ['\033[42m', '\033[49m'],
'bgYellow': ['\033[43m', '\033[49m'],
'bgBlue': ['\033[44m', '\033[49m'],
'bgMagenta': ['\033[45m', '\033[49m'],
'bgCyan': ['\033[46m', '\033[49m'],
'bgWhite': ['\033[47m', '\033[49m'],
'bgDefault': ['\033[49m', '\033[49m']
};
Branch LogicalExpression
✓ Was returned
var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
✗ Was not returned
var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
Branch LogicalExpression
✓ Was returned
var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
✗ Was not returned
var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
var enabled = !process.env.NOCOLOR && tty.isatty(1) && tty.isatty(2);
module.exports = {};
Object.keys(styles).forEach(function (style) {
Function (anonymous_485)
✗ Was not called
module.exports[style] = function (str) {···
return enabled ? styles[style][0] + str + styles[style][1] : str;
};
module.exports[style] = function (str) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return enabled ? styles[style][0] + str + styles[style][1] : str;
✗ Negative was not returned (: ...)
return enabled ? styles[style][0] + str + styles[style][1] : str;
return enabled ? styles[style][0] + str + styles[style][1] : str;
};
});
project-config.js
/**
* ProjectConfig
* =============
*/
var NodeConfig = require('./node-config');
var NodeMaskConfig = require('./node-mask-config');
var TaskConfig = require('./task-config');
var ModeConfig = require('./mode-config');
var inherit = require('inherit');
var dirGlob = require('../fs/dir-glob');
var path = require('path');
var dropRequireCache = require('../fs/drop-require-cache');
/**
* Инстанции класса ProjectConfig передаются в enb-make-файлы.
* С помощью инстанций этого класса производится настройка сборки проекта.
* @name ProjectConfig
*/
module.exports = inherit( /** @lends ProjectConfig.prototype */ {
/**
* Конструктор.
* @param {String} rootPath Путь к корню проекта.
* @private
*/
Function (anonymous_486)
✗ Was not called
__constructor: function (rootPath) {···
this._rootPath = rootPath;
this._nodeConfigs = {};
this._tasks = {};
this._nodeMaskConfigs = [];
this._languages = null;
this._levelNamingSchemes = [];
/**
* @type {{ModuleConfig}}
* @private
*/
this._modules = {};
var env = this._env = {};
this._modes = {};
var processEnv = process.env;
Object.keys(processEnv).forEach(function (key) {
env[key] = processEnv[key];
});
},
__constructor: function (rootPath) {
this._rootPath = rootPath;
this._nodeConfigs = {};
this._tasks = {};
this._nodeMaskConfigs = [];
this._languages = null;
this._levelNamingSchemes = [];
/**
* @type {{ModuleConfig}}
* @private
*/
this._modules = {};
var env = this._env = {};
this._modes = {};
var processEnv = process.env;
Function (anonymous_487)
✗ Was not called
Object.keys(processEnv).forEach(function (key) {···
env[key] = processEnv[key];
});
Object.keys(processEnv).forEach(function (key) {
env[key] = processEnv[key];
});
},
/**
* Возвращает языки для проекта.
* @returns {String[]}
*/
Function (anonymous_488)
✗ Was not called
getLanguages: function () {···
return this._languages;
},
getLanguages: function () {
return this._languages;
},
/**
* Устанавливает языки для проекта.
* @param {String[]} languages
* @returns {ProjectConfig}
*/
Function (anonymous_489)
✗ Was not called
setLanguages: function (languages) {···
this._languages = languages;
return this;
},
setLanguages: function (languages) {
this._languages = languages;
return this;
},
/**
* Возвращает путь к корню проекта.
* @returns {String}
*/
Function (anonymous_490)
✗ Was not called
getRootPath: function () {···
return this._rootPath;
},
getRootPath: function () {
return this._rootPath;
},
/**
* Возвращает абсолютный путь к файлу на основе пути, относительно корня проекта.
* @param {String|Object} path
* @returns {String}
*/
Function (anonymous_491)
✗ Was not called
resolvePath: function (sourcePath) {···
if (sourcePath) {
if (typeof sourcePath === 'string') {
return path.resolve(this._rootPath, sourcePath);
} else {
sourcePath.path = path.resolve(this._rootPath, sourcePath.path);
return sourcePath;
}
} else {
return this._rootPath;
}
},
resolvePath: function (sourcePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (sourcePath) {···
if (typeof sourcePath === 'string') {
return path.resolve(this._rootPath, sourcePath);
} else {
sourcePath.path = path.resolve(this._rootPath, sourcePath.path);
return sourcePath;
}
} else {
✗ Negative was not executed (else)
} else {···
return this._rootPath;
}
if (sourcePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof sourcePath === 'string') {···
return path.resolve(this._rootPath, sourcePath);
} else {
✗ Negative was not executed (else)
} else {···
sourcePath.path = path.resolve(this._rootPath, sourcePath.path);
return sourcePath;
}
if (typeof sourcePath === 'string') {
return path.resolve(this._rootPath, sourcePath);
} else {
sourcePath.path = path.resolve(this._rootPath, sourcePath.path);
return sourcePath;
}
} else {
return this._rootPath;
}
},
/**
* Объявляет ноду.
* Необходимо объявить все ноды, используемые в сборке.
* @param {String} path
* @param {Function} func Конфигуратор ноды.
* @returns {ProjectConfig}
*/
Function (anonymous_492)
✗ Was not called
node: function (path, func) {···
path = path.replace(/^\/+|\/+$/g, '');
if (!this._nodeConfigs[path]) {
this._nodeConfigs[path] = new NodeConfig(path, this._rootPath, this);
}
if (func) {
this._nodeConfigs[path].addChain(func);
}
return this;
},
node: function (path, func) {
path = path.replace(/^\/+|\/+$/g, '');
Branch IfStatement
✗ Positive was not executed (if)
if (!this._nodeConfigs[path]) {···
this._nodeConfigs[path] = new NodeConfig(path, this._rootPath, this);
}
✗ Negative was not executed (else)
}···
if (func) {
if (!this._nodeConfigs[path]) {
this._nodeConfigs[path] = new NodeConfig(path, this._rootPath, this);
}
Branch IfStatement
✗ Positive was not executed (if)
if (func) {···
this._nodeConfigs[path].addChain(func);
}
✗ Negative was not executed (else)
}···
return this;
if (func) {
this._nodeConfigs[path].addChain(func);
}
return this;
},
/**
* Объявляет набор нод.
* Ноды можно объявлять по shell-маске.
* @param {String} path1 ,..
* @param {Function} [func]
* @returns {ProjectConfig}
*/
Function (anonymous_493)
✗ Was not called
nodes: function () {···
var result;
var input = arguments;
var flat = false;
var root = this._rootPath;
var fn;
function toRelative(path) {
return path.replace(root + '/', '');
}
while (!flat) {
flat = true;
result = [];
for (var i = 0, l = input.length; i < l; i++) {
var item = input[i];
if (typeof item === 'function') {
fn = item;
} else if (Array.isArray(item)) {
result = result.concat(item);
flat = false;
} else if (item && typeof item === 'string') {
if (~item.indexOf('*')) {
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
result.push(item);
}
}
}
input = result;
}
var _this = this;
result.forEach(function (nodePath) {
_this.node(nodePath, fn);
});
return this;
},
nodes: function () {
var result;
var input = arguments;
var flat = false;
var root = this._rootPath;
var fn;
Function toRelative
✗ Was not called
function toRelative(path) {···
return path.replace(root + '/', '');
}
function toRelative(path) {
return path.replace(root + '/', '');
}
while (!flat) {
flat = true;
result = [];
for (var i = 0, l = input.length; i < l; i++) {
var item = input[i];
Branch IfStatement
✗ Positive was not executed (if)
if (typeof item === 'function') {···
fn = item;
} else if (Array.isArray(item)) {
✗ Negative was not executed (else)
} else if (Array.isArray(item)) {···
result = result.concat(item);
flat = false;
} else if (item && typeof item === 'string') {
if (~item.indexOf('*')) {
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
result.push(item);
}
}
if (typeof item === 'function') {
fn = item;
Branch IfStatement
✗ Positive was not executed (if)
} else if (Array.isArray(item)) {···
result = result.concat(item);
flat = false;
} else if (item && typeof item === 'string') {
✗ Negative was not executed (else)
} else if (item && typeof item === 'string') {···
if (~item.indexOf('*')) {
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
result.push(item);
}
}
} else if (Array.isArray(item)) {
result = result.concat(item);
flat = false;
Branch IfStatement
✗ Positive was not executed (if)
} else if (item && typeof item === 'string') {···
if (~item.indexOf('*')) {
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
result.push(item);
}
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
} else if (item && typeof item === 'string') {
✗ Was not returned
} else if (item && typeof item === 'string') {
} else if (item && typeof item === 'string') {
Branch IfStatement
✗ Positive was not executed (if)
if (~item.indexOf('*')) {···
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
✗ Negative was not executed (else)
} else {···
result.push(item);
}
if (~item.indexOf('*')) {
result = result.concat(dirGlob.globSync(root + '/' + item).map(toRelative));
} else {
result.push(item);
}
}
}
input = result;
}
var _this = this;
Function (anonymous_495)
✗ Was not called
result.forEach(function (nodePath) {···
_this.node(nodePath, fn);
});
result.forEach(function (nodePath) {
_this.node(nodePath, fn);
});
return this;
},
/**
* Настраивает ноды по маске. Маска задается с помощью регулярного выражения.
* Имейте ввиду, что ноды должны быть добавлены в конфигурацию проекта с помощью метода node или аналогов.
* @param {RegExp} mask
* @param {Function} func
* @returns {ProjectConfig}
*/
Function (anonymous_496)
✗ Was not called
nodeMask: function (mask, func) {···
var nodeMask = new NodeMaskConfig(mask);
nodeMask.addChain(func);
this._nodeMaskConfigs.push(nodeMask);
return this;
},
nodeMask: function (mask, func) {
var nodeMask = new NodeMaskConfig(mask);
nodeMask.addChain(func);
this._nodeMaskConfigs.push(nodeMask);
return this;
},
/**
* Объявляет таск. Таск может быть выполнен с помощью ./node_modules/.bin/enb make task_name
* @param {String} name
* @param {Function} func
* @returns {ProjectConfig}
*/
Function (anonymous_497)
✗ Was not called
task: function (name, func) {···
if (!this._tasks[name]) {
this._tasks[name] = new TaskConfig(name);
}
this._tasks[name].addChain(func);
return this;
},
task: function (name, func) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._tasks[name]) {···
this._tasks[name] = new TaskConfig(name);
}
✗ Negative was not executed (else)
}···
this._tasks[name].addChain(func);
if (!this._tasks[name]) {
this._tasks[name] = new TaskConfig(name);
}
this._tasks[name].addChain(func);
return this;
},
/**
* Конфигурирует проект для конкретного режима.
* Режим задается с помощью ENV-переменной YENV.
* @param {String} name
* @param {Function} func
* @returns {ProjectConfig}
*/
Function (anonymous_498)
✗ Was not called
mode: function (name, func) {···
if (!this._modes[name]) {
this._modes[name] = new ModeConfig(name);
}
this._modes[name].addChain(func);
return this;
},
mode: function (name, func) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._modes[name]) {···
this._modes[name] = new ModeConfig(name);
}
✗ Negative was not executed (else)
}···
this._modes[name].addChain(func);
if (!this._modes[name]) {
this._modes[name] = new ModeConfig(name);
}
this._modes[name].addChain(func);
return this;
},
/**
* Регистрирует модуль.
* @param {String} name
* @param {ModuleConfig} moduleConfig
*/
Function (anonymous_499)
✗ Was not called
registerModule: function (name, moduleConfig) {···
if (!this._modules[name]) {
this._modules[name] = moduleConfig;
} else {
throw new Error('Module "' + name + '" is already registered.');
}
},
registerModule: function (name, moduleConfig) {
Branch IfStatement
✗ Positive was not executed (if)
if (!this._modules[name]) {···
this._modules[name] = moduleConfig;
} else {
✗ Negative was not executed (else)
} else {···
throw new Error('Module "' + name + '" is already registered.');
}
if (!this._modules[name]) {
this._modules[name] = moduleConfig;
} else {
throw new Error('Module "' + name + '" is already registered.');
}
},
/**
* Настраивает модуль.
* @param {String} name
* @param {Function} func
* @returns {ProjectConfig|ModuleConfig}
*/
Function (anonymous_500)
✗ Was not called
module: function (name, func) {···
var module = this._modules[name];
if (module) {
if (func) {
module.addChain(func);
return this;
} else {
return module;
}
} else {
throw new Error('Module "' + name + '" is not registered.');
}
},
module: function (name, func) {
var module = this._modules[name];
Branch IfStatement
✗ Positive was not executed (if)
if (module) {···
if (func) {
module.addChain(func);
return this;
} else {
return module;
}
} else {
✗ Negative was not executed (else)
} else {···
throw new Error('Module "' + name + '" is not registered.');
}
if (module) {
Branch IfStatement
✗ Positive was not executed (if)
if (func) {···
module.addChain(func);
return this;
} else {
✗ Negative was not executed (else)
} else {···
return module;
}
if (func) {
module.addChain(func);
return this;
} else {
return module;
}
} else {
throw new Error('Module "' + name + '" is not registered.');
}
},
Function (anonymous_501)
✗ Was not called
getTaskConfigs: function () {···
return this._tasks;
},
getTaskConfigs: function () {
return this._tasks;
},
Function (anonymous_502)
✗ Was not called
getTaskConfig: function (taskName) {···
return this._tasks[taskName];
},
getTaskConfig: function (taskName) {
return this._tasks[taskName];
},
Function (anonymous_503)
✗ Was not called
getModeConfigs: function () {···
return this._modes;
},
getModeConfigs: function () {
return this._modes;
},
Function (anonymous_504)
✗ Was not called
getModeConfig: function (modeName) {···
return this._modes[modeName];
},
getModeConfig: function (modeName) {
return this._modes[modeName];
},
Function (anonymous_505)
✗ Was not called
getNodeConfigs: function () {···
return this._nodeConfigs;
},
getNodeConfigs: function () {
return this._nodeConfigs;
},
Function (anonymous_506)
✗ Was not called
getNodeConfig: function (nodeName) {···
return this._nodeConfigs[nodeName];
},
getNodeConfig: function (nodeName) {
return this._nodeConfigs[nodeName];
},
Function (anonymous_507)
✗ Was not called
getNodeMaskConfigs: function (nodePath) {···
return nodePath ? this._nodeMaskConfigs.filter(function (nodeMask) {
return nodeMask.getMask().test(nodePath);
}) : this._nodeMaskConfigs;
},
getNodeMaskConfigs: function (nodePath) {
Function (anonymous_508)
✗ Was not called
return nodePath ? this._nodeMaskConfigs.filter(function (nodeMask) {···
return nodeMask.getMask().test(nodePath);
}) : this._nodeMaskConfigs;
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return nodePath ? this._nodeMaskConfigs.filter(function (nodeMask) {···
return nodeMask.getMask().test(nodePath);
}) : this._nodeMaskConfigs;
✗ Negative was not returned (: ...)
}) : this._nodeMaskConfigs;
return nodePath ? this._nodeMaskConfigs.filter(function (nodeMask) {
return nodeMask.getMask().test(nodePath);
}) : this._nodeMaskConfigs;
},
/**
* Возвращает установленную переменную среды.
* @param {String} key
* @returns {String}
*/
Function (anonymous_509)
✗ Was not called
getEnv: function (key) {···
return this._env[key];
},
getEnv: function (key) {
return this._env[key];
},
/**
* Устанавливает переменные среды.
* Переменные среды попадают в shell-команды в тасках.
* @param {String} key
* @param {String} value
*/
Function (anonymous_510)
✗ Was not called
setEnv: function (key, value) {···
var _this = this;
if (typeof key === 'object') {
Object.keys(key).forEach(function (name) {
_this._env[name] = key[name];
});
} else {
_this._env[key] = value;
}
},
setEnv: function (key, value) {
var _this = this;
Branch IfStatement
✗ Positive was not executed (if)
if (typeof key === 'object') {···
Object.keys(key).forEach(function (name) {
_this._env[name] = key[name];
});
} else {
✗ Negative was not executed (else)
} else {···
_this._env[key] = value;
}
if (typeof key === 'object') {
Function (anonymous_511)
✗ Was not called
Object.keys(key).forEach(function (name) {···
_this._env[name] = key[name];
});
Object.keys(key).forEach(function (name) {
_this._env[name] = key[name];
});
} else {
_this._env[key] = value;
}
},
Function (anonymous_512)
✗ Was not called
getEnvValues: function () {···
return this._env;
},
getEnvValues: function () {
return this._env;
},
/**
* Подключает другой enb-make-файл с конфигурацией сборки.
* @param {String} filename
* @returns {ProjectConfig}
*/
Function (anonymous_513)
✗ Was not called
includeConfig: function (filename) {···
filename = require.resolve(filename);
(this._includedConfigFilenames || (this._includedConfigFilenames = [])).push(filename);
dropRequireCache(require, filename);
require(filename)(this);
return this;
},
includeConfig: function (filename) {
filename = require.resolve(filename);
Branch LogicalExpression
✗ Was not returned
(this._includedConfigFilenames || (this._includedConfigFilenames = [])).push(filename);
✗ Was not returned
(this._includedConfigFilenames || (this._includedConfigFilenames = [])).push(filename);
(this._includedConfigFilenames || (this._includedConfigFilenames = [])).push(filename);
dropRequireCache(require, filename);
require(filename)(this);
return this;
},
/**
* Возвращает список подключенных enb-make-файлов.
* @returns {String[]}
*/
Function (anonymous_514)
✗ Was not called
getIncludedConfigFilenames: function () {···
return this._includedConfigFilenames || [];
},
getIncludedConfigFilenames: function () {
Branch LogicalExpression
✗ Was not returned
return this._includedConfigFilenames || [];
✗ Was not returned
return this._includedConfigFilenames || [];
return this._includedConfigFilenames || [];
},
/**
* Устанавливает схему именования для уровня переопределения.
* В функцию формирования схемы именования первым аргументом указывается абсолютный путь до уровня переопределения,
* а вторым аргументом — инстанция LevelBuilder.
* Схема именования должна содержать два метода:
* ```javascript
* // Выполняет построение структуры файлов уровня переопределения, используя методы инстанции класса LevelBuilder.
* {Promise} buildLevel( {String} levelPath, {LevelBuilder} levelBuilder )
* // Возвращает путь к файлу на основе пути к уровню переопределения и BEM-описания.
* {String} buildFilePath(
* {String} levelPath, {String} blockName, {String} elemName, {String} modName, {String} modVal
* )
* ```
* @param {String|Array} level
* @param {Function} schemeBuilder
*/
Function (anonymous_515)
✗ Was not called
setLevelNamingScheme: function (level, schemeBuilder) {···
var levels = Array.isArray(level) ? level : [level];
var _this = this;
levels.forEach(function (levelPath) {
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
return this;
},
setLevelNamingScheme: function (level, schemeBuilder) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var levels = Array.isArray(level) ? level : [level];
✗ Negative was not returned (: ...)
var levels = Array.isArray(level) ? level : [level];
var levels = Array.isArray(level) ? level : [level];
var _this = this;
Function (anonymous_516)
✗ Was not called
levels.forEach(function (levelPath) {···
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
levels.forEach(function (levelPath) {
Branch IfStatement
✗ Positive was not executed (if)
if (levelPath.charAt(0) !== '/') {···
levelPath = _this.resolvePath(levelPath);
}
✗ Negative was not executed (else)
}···
_this._levelNamingSchemes[levelPath] = schemeBuilder;
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
return this;
},
/**
* Возвращает схемы именования для уровней переопределения.
* @returns {Array}
*/
Function (anonymous_517)
✗ Was not called
getLevelNamingSchemes: function () {···
return this._levelNamingSchemes;
}
getLevelNamingSchemes: function () {
return this._levelNamingSchemes;
}
});
node-config.js
/**
* NodeConfig
* ==========
*/
var path = require('path');
var inherit = require('inherit');
var ModeConfig = require('./mode-config');
/**
* NodeConfig передается в коллбэки при объявлении ноды (ProjectConfig::node)
* и при матчинге ноды (ProjectConfig::nodeMask).
* @name NodeConfig
*/
module.exports = inherit(require('./configurable'), /** @lends NodeConfig.prototype */ {
/**
* Конструктор.
* @param {String} nodePath Относительный путь к ноде.
* @param {String} root Абсолютный путь к корню проекта.
* @param {ProjectConfig} projectConfig Ссылка на конфигурацию проекта.
*/
Function (anonymous_518)
✗ Was not called
__constructor: function (nodePath, root, projectConfig) {···
this.__base();
this._baseName = path.basename(nodePath);
this._path = nodePath;
this._root = root;
this._targets = [];
this._cleanTargets = [];
this._techs = [];
this._languages = null;
this._projectConfig = projectConfig;
this._modes = {};
},
__constructor: function (nodePath, root, projectConfig) {
this.__base();
this._baseName = path.basename(nodePath);
this._path = nodePath;
this._root = root;
this._targets = [];
this._cleanTargets = [];
this._techs = [];
this._languages = null;
this._projectConfig = projectConfig;
this._modes = {};
},
/**
* Конфигурирует ноду для заданного режима.
* Например:
* ```javascript
* config.node('pages/index', function (nodeConfig) {
* ...
* nodeConfig.mode('development', function (nodeConfig) {
* nodeConfig.addTech(require('file-copy'), { sourceTarget: '?.js', destTarget: '_?.js' });
* });
* nodeConfig.mode('production', function (nodeConfig) {
* nodeConfig.addTech(require('borschik'), { sourceTarget: '?.js', destTarget: '_?.js' });
* });
* });
* ```
* @param {String} modeName
* @param {Function} cb
* @returns {NodeConfig}
*/
Function (anonymous_519)
✗ Was not called
mode: function (modeName, cb) {···
var modeConfig = this._modes[modeName];
if (!modeConfig) {
modeConfig = this._modes[modeName] = new ModeConfig(modeName);
}
modeConfig.addChain(cb);
return this;
},
mode: function (modeName, cb) {
var modeConfig = this._modes[modeName];
Branch IfStatement
✗ Positive was not executed (if)
if (!modeConfig) {···
modeConfig = this._modes[modeName] = new ModeConfig(modeName);
}
✗ Negative was not executed (else)
}···
modeConfig.addChain(cb);
if (!modeConfig) {
modeConfig = this._modes[modeName] = new ModeConfig(modeName);
}
modeConfig.addChain(cb);
return this;
},
/**
* Возвращает конфигуратор ноды для заданного режима.
* @param {String} modeName
* @returns {ModeConfig|undefined}
*/
Function (anonymous_520)
✗ Was not called
getModeConfig: function (modeName) {···
return this._modes[modeName];
},
getModeConfig: function (modeName) {
return this._modes[modeName];
},
/**
* Устанавливает языки для ноды.
* @param {String[]} languages
* @return {NodeConfig}
*/
Function (anonymous_521)
✗ Was not called
setLanguages: function (languages) {···
this._languages = languages;
return this;
},
setLanguages: function (languages) {
this._languages = languages;
return this;
},
/**
* Возвращает языки для ноды.
* @returns {String[]}
*/
Function (anonymous_522)
✗ Was not called
getLanguages: function () {···
return this._languages;
},
getLanguages: function () {
return this._languages;
},
/**
* Возвращает абсолютный путь к ноде.
* @returns {String}
*/
Function (anonymous_523)
✗ Was not called
getNodePath: function () {···
return this._root + '/' + this._path;
},
getNodePath: function () {
return this._root + '/' + this._path;
},
/**
* Возвращает абсолютный путь к файлу на основе пути, относительно ноды.
* @param {String} path
* @returns {String}
*/
Function (anonymous_524)
✗ Was not called
resolvePath: function (path) {···
return this._root + '/' + this._path + (path ? '/' + path : '');
},
resolvePath: function (path) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return this._root + '/' + this._path + (path ? '/' + path : '');
✗ Negative was not returned (: ...)
return this._root + '/' + this._path + (path ? '/' + path : '');
return this._root + '/' + this._path + (path ? '/' + path : '');
},
Function (anonymous_525)
✗ Was not called
_processTarget: function (target) {···
var targetSources = {
'lang': this._languages || this._projectConfig.getLanguages()
};
var targets = [];
target = target.replace(/^\/+|\/+$/g, '').replace(/\?/g, this._baseName);

function processTarget (target) {
var match = target.match(/{(\w+)}/);
if (match) {
var varName = match[1];
var values = targetSources[varName] || [];
var regex = new RegExp('{' + varName + '}', 'g');
if (values.length) {
values.forEach(function (value) {
newTargetsToProcess.push(target.replace(regex, value));
});
} else {
newTargetsToProcess.push(target.replace(regex, ''));
}
} else {
targets.push(target);
}
}

if (/{\w+}/.test(target)) {
var targetsToProcess = [target];
var newTargetsToProcess;
while (targetsToProcess.length) {
newTargetsToProcess = [];
targetsToProcess.forEach(processTarget);
targetsToProcess = newTargetsToProcess;
}
} else {
targets.push(target);
}
return targets;
},
_processTarget: function (target) {
var targetSources = {
Branch LogicalExpression
✗ Was not returned
'lang': this._languages || this._projectConfig.getLanguages()
✗ Was not returned
'lang': this._languages || this._projectConfig.getLanguages()
'lang': this._languages || this._projectConfig.getLanguages()
};
var targets = [];
target = target.replace(/^\/+|\/+$/g, '').replace(/\?/g, this._baseName);
Function processTarget
✗ Was not called
function processTarget (target) {···
var match = target.match(/{(\w+)}/);
if (match) {
var varName = match[1];
var values = targetSources[varName] || [];
var regex = new RegExp('{' + varName + '}', 'g');
if (values.length) {
values.forEach(function (value) {
newTargetsToProcess.push(target.replace(regex, value));
});
} else {
newTargetsToProcess.push(target.replace(regex, ''));
}
} else {
targets.push(target);
}
}
function processTarget (target) {
var match = target.match(/{(\w+)}/);
Branch IfStatement
✗ Positive was not executed (if)
if (match) {···
var varName = match[1];
var values = targetSources[varName] || [];
var regex = new RegExp('{' + varName + '}', 'g');
if (values.length) {
values.forEach(function (value) {
newTargetsToProcess.push(target.replace(regex, value));
});
} else {
newTargetsToProcess.push(target.replace(regex, ''));
}
} else {
✗ Negative was not executed (else)
} else {···
targets.push(target);
}
if (match) {
var varName = match[1];
Branch LogicalExpression
✗ Was not returned
var values = targetSources[varName] || [];
✗ Was not returned
var values = targetSources[varName] || [];
var values = targetSources[varName] || [];
var regex = new RegExp('{' + varName + '}', 'g');
Branch IfStatement
✗ Positive was not executed (if)
if (values.length) {···
values.forEach(function (value) {
newTargetsToProcess.push(target.replace(regex, value));
});
} else {
✗ Negative was not executed (else)
} else {···
newTargetsToProcess.push(target.replace(regex, ''));
}
if (values.length) {
Function (anonymous_527)
✗ Was not called
values.forEach(function (value) {···
newTargetsToProcess.push(target.replace(regex, value));
});
values.forEach(function (value) {
newTargetsToProcess.push(target.replace(regex, value));
});
} else {
newTargetsToProcess.push(target.replace(regex, ''));
}
} else {
targets.push(target);
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (/{\w+}/.test(target)) {···
var targetsToProcess = [target];
var newTargetsToProcess;
while (targetsToProcess.length) {
newTargetsToProcess = [];
targetsToProcess.forEach(processTarget);
targetsToProcess = newTargetsToProcess;
}
} else {
✗ Negative was not executed (else)
} else {···
targets.push(target);
}
if (/{\w+}/.test(target)) {
var targetsToProcess = [target];
var newTargetsToProcess;
while (targetsToProcess.length) {
newTargetsToProcess = [];
targetsToProcess.forEach(processTarget);
targetsToProcess = newTargetsToProcess;
}
} else {
targets.push(target);
}
return targets;
},
/**
* Добавляет таргеты.
* @param {String[]} targets
* @returns {NodeConfig}
*/
Function (anonymous_528)
✗ Was not called
addTargets: function (targets) {···
var _this = this;
targets.forEach(function (target) {
_this.addTarget(target);
});
return this;
},
addTargets: function (targets) {
var _this = this;
Function (anonymous_529)
✗ Was not called
targets.forEach(function (target) {···
_this.addTarget(target);
});
targets.forEach(function (target) {
_this.addTarget(target);
});
return this;
},
/**
* Добавляет таргет.
* @param {String} target
* @returns {NodeConfig}
*/
Function (anonymous_530)
✗ Was not called
addTarget: function (target) {···
this._targets = this._targets.concat(this._processTarget(target));
return this;
},
addTarget: function (target) {
this._targets = this._targets.concat(this._processTarget(target));
return this;
},
/**
* Добавляет таргеты, которые необходимо удалять при make clean.
* @param {String[]} targets
* @returns {NodeConfig}
*/
Function (anonymous_531)
✗ Was not called
addCleanTargets: function (targets) {···
var _this = this;
targets.forEach(function (target) {
_this.addCleanTarget(target);
});
return this;
},
addCleanTargets: function (targets) {
var _this = this;
Function (anonymous_532)
✗ Was not called
targets.forEach(function (target) {···
_this.addCleanTarget(target);
});
targets.forEach(function (target) {
_this.addCleanTarget(target);
});
return this;
},
/**
* Добавляет таргет, который необходимо удалять при make clean.
* @param {String} target
* @returns {NodeConfig}
*/
Function (anonymous_533)
✗ Was not called
addCleanTarget: function (target) {···
this._cleanTargets = this._cleanTargets.concat(this._processTarget(target));
return this;
},
addCleanTarget: function (target) {
this._cleanTargets = this._cleanTargets.concat(this._processTarget(target));
return this;
},
/**
* Добавляет технологии.
* @param {Array} techs
* @returns {NodeConfig}
*/
Function (anonymous_534)
✗ Was not called
addTechs: function (techs) {···
var _this = this;
techs.forEach(function (tech) {
_this.addTech(tech);
});
return this;
},
addTechs: function (techs) {
var _this = this;
Function (anonymous_535)
✗ Was not called
techs.forEach(function (tech) {···
_this.addTech(tech);
});
techs.forEach(function (tech) {
_this.addTech(tech);
});
return this;
},
Function (anonymous_536)
✗ Was not called
_processTechOptions: function (options) {···
var processLangs = false;
var optVal;
var i;
var p;
for (i in options) {
if (options.hasOwnProperty(i) &&
typeof (optVal = options[i]) === 'string' &&
optVal.indexOf('{lang}') !== -1
) {
processLangs = true;
break;
}
}
if (processLangs) {
var result = [];
var langs = this._languages || this._projectConfig.getLanguages();
for (var j = 0, l = langs.length; j < l; j++) {
var optionsForLang = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
optionsForLang[i] = optVal.substr(0, p) + langs[j] + optVal.substr(p + 6);
} else {
optionsForLang[i] = optVal;
}
}
}
result.push(optionsForLang);
}
return result;
} else {
return [options];
}
},
_processTechOptions: function (options) {
var processLangs = false;
var optVal;
var i;
var p;
for (i in options) {
Branch IfStatement
✗ Positive was not executed (if)
) {···
processLangs = true;
break;
}
✗ Negative was not executed (else)
}···
}
Branch LogicalExpression
✗ Was not returned
optVal.indexOf('{lang}') !== -1
✗ Was not returned
if (options.hasOwnProperty(i) &&···
typeof (optVal = options[i]) === 'string' &&
Branch LogicalExpression
✗ Was not returned
typeof (optVal = options[i]) === 'string' &&
✗ Was not returned
if (options.hasOwnProperty(i) &&
if (options.hasOwnProperty(i) &&
typeof (optVal = options[i]) === 'string' &&
optVal.indexOf('{lang}') !== -1
) {
processLangs = true;
break;
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (processLangs) {···
var result = [];
var langs = this._languages || this._projectConfig.getLanguages();
for (var j = 0, l = langs.length; j < l; j++) {
var optionsForLang = {};
for (i in options) {
if (options.hasOwnProperty(i)) {
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
optionsForLang[i] = optVal.substr(0, p) + langs[j] + optVal.substr(p + 6);
} else {
optionsForLang[i] = optVal;
}
}
}
result.push(optionsForLang);
}
return result;
} else {
✗ Negative was not executed (else)
} else {···
return [options];
}
if (processLangs) {
var result = [];
Branch LogicalExpression
✗ Was not returned
var langs = this._languages || this._projectConfig.getLanguages();
✗ Was not returned
var langs = this._languages || this._projectConfig.getLanguages();
var langs = this._languages || this._projectConfig.getLanguages();
for (var j = 0, l = langs.length; j < l; j++) {
var optionsForLang = {};
for (i in options) {
Branch IfStatement
✗ Positive was not executed (if)
if (options.hasOwnProperty(i)) {···
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
optionsForLang[i] = optVal.substr(0, p) + langs[j] + optVal.substr(p + 6);
} else {
optionsForLang[i] = optVal;
}
}
✗ Negative was not executed (else)
}···
}
if (options.hasOwnProperty(i)) {
Branch IfStatement
✗ Positive was not executed (if)
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {···
optionsForLang[i] = optVal.substr(0, p) + langs[j] + optVal.substr(p + 6);
} else {
✗ Negative was not executed (else)
} else {···
optionsForLang[i] = optVal;
}
Branch LogicalExpression
✗ Was not returned
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
✗ Was not returned
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
if (typeof (optVal = options[i]) === 'string' && (p = optVal.indexOf('{lang}')) !== -1) {
optionsForLang[i] = optVal.substr(0, p) + langs[j] + optVal.substr(p + 6);
} else {
optionsForLang[i] = optVal;
}
}
}
result.push(optionsForLang);
}
return result;
} else {
return [options];
}
},
/**
* Добавляет технологию.
* @param {Tech|Function|Array} tech
* @returns {NodeConfig}
*/
Function (anonymous_537)
✗ Was not called
addTech: function (tech) {···
if (Array.isArray(tech)) {
var techClass = tech[0];
var techOptions = tech[1] || {};
var techOptionList = this._processTechOptions(techOptions);
for (var i = 0, l = techOptionList.length; i < l; i++) {
this._techs.push(new techClass(techOptionList[i]));
}
} else if (typeof tech === 'function') {
this._techs.push(new tech());
} else {
this._techs.push(tech);
}
return this;
},
addTech: function (tech) {
Branch IfStatement
✗ Positive was not executed (if)
if (Array.isArray(tech)) {···
var techClass = tech[0];
var techOptions = tech[1] || {};
var techOptionList = this._processTechOptions(techOptions);
for (var i = 0, l = techOptionList.length; i < l; i++) {
this._techs.push(new techClass(techOptionList[i]));
}
} else if (typeof tech === 'function') {
✗ Negative was not executed (else)
} else if (typeof tech === 'function') {···
this._techs.push(new tech());
} else {
this._techs.push(tech);
}
if (Array.isArray(tech)) {
var techClass = tech[0];
Branch LogicalExpression
✗ Was not returned
var techOptions = tech[1] || {};
✗ Was not returned
var techOptions = tech[1] || {};
var techOptions = tech[1] || {};
var techOptionList = this._processTechOptions(techOptions);
for (var i = 0, l = techOptionList.length; i < l; i++) {
this._techs.push(new techClass(techOptionList[i]));
}
Branch IfStatement
✗ Positive was not executed (if)
} else if (typeof tech === 'function') {···
this._techs.push(new tech());
} else {
✗ Negative was not executed (else)
} else {···
this._techs.push(tech);
}
} else if (typeof tech === 'function') {
this._techs.push(new tech());
} else {
this._techs.push(tech);
}
return this;
},
Function (anonymous_538)
✗ Was not called
getTargets: function () {···
return this._targets;
},
getTargets: function () {
return this._targets;
},
Function (anonymous_539)
✗ Was not called
getCleanTargets: function () {···
return this._cleanTargets;
},
getCleanTargets: function () {
return this._cleanTargets;
},
Function (anonymous_540)
✗ Was not called
getTechs: function () {···
return this._techs;
},
getTechs: function () {
return this._techs;
},
Function (anonymous_541)
✗ Was not called
getPath: function () {···
return this._path;
}
getPath: function () {
return this._path;
}
});
mode-config.js
/**
* ModeConfig
* ==========
*/
var inherit = require('inherit');
/**
* ModeConfig используется для конфигурации проекта в рамках режима.
* Режим задается с помощью ENV-переменной YENV.
* @name ModeConfig
*/
module.exports = inherit(require('./configurable'), {
Function (anonymous_542)
✗ Was not called
__constructor: function (modeName) {···
this.__base();
this._name = modeName;
}
__constructor: function (modeName) {
this.__base();
this._name = modeName;
}
});
configurable.js
/**
* Configurable
* ============
*/
var inherit = require('inherit');
var Vow = require('vow');
/**
* Configurable — базовый для классов, конфигурируемых коллбэками.
* @name Configurable
*/
module.exports = inherit( /** @lends Configurable.prototype */ {
/**
* Конструктор.
*/
Function (anonymous_543)
✗ Was not called
__constructor: function () {···
this._chains = [];
},
__constructor: function () {
this._chains = [];
},
/**
* Добавляет коллбэк конфигурации.
* @param {Function} cb
*/
Function (anonymous_544)
✗ Was not called
addChain: function (cb) {···
this._chains.push(cb);
return this;
},
addChain: function (cb) {
this._chains.push(cb);
return this;
},
/**
* Алиас к addChain.
* @param {...Function} cb
*/
Function (anonymous_545)
✗ Was not called
configure: function () {···
return this.addChain.apply(this, arguments);
},
configure: function () {
return this.addChain.apply(this, arguments);
},
/**
* Выполняет цепочку коллбэков-конфигураторов.
* В случае, если конфигуратор возвращает промис, выполнение происходит асинхронно.
* @param {Object[]} args Аргументы, которые надо передавать в кажджый конфигуратор.
* @param {Object} ctxObject Контекст выполнения. Передается первым параметром в конфигураторы.
* @returns {Promise|undefined}
*/
Function (anonymous_546)
✗ Was not called
exec: function (args, ctxObject) {···
args = [ctxObject || this].concat(args || []);
var chains = this._chains.slice(0);
function keepRunning() {
var chain = chains.shift();
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
return keepRunning();
}
exec: function (args, ctxObject) {
Branch LogicalExpression
✗ Was not returned
args = [ctxObject || this].concat(args || []);
✗ Was not returned
args = [ctxObject || this].concat(args || []);
Branch LogicalExpression
✗ Was not returned
args = [ctxObject || this].concat(args || []);
✗ Was not returned
args = [ctxObject || this].concat(args || []);
args = [ctxObject || this].concat(args || []);
var chains = this._chains.slice(0);
Function keepRunning
✗ Was not called
function keepRunning() {···
var chain = chains.shift();
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
function keepRunning() {
var chain = chains.shift();
Function (anonymous_548)
✗ Was not called
return chain && Vow.when(chain.apply(this, args)).then(function () {···
return keepRunning();
});
Branch LogicalExpression
✗ Was not returned
return chain && Vow.when(chain.apply(this, args)).then(function () {···
return keepRunning();
});
✗ Was not returned
return chain && Vow.when(chain.apply(this, args)).then(function () {
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
return keepRunning();
}
});
node-mask-config.js
/**
* NodeMaskConfig
* ==============
*/
var inherit = require('inherit');
/**
* NodeMaskConfig используется для конфигурации нод, путь которых соответствует регулярному выражению.
* @name NodeMaskConfig
*/
module.exports = inherit(require('./configurable'), {
Function (anonymous_549)
✗ Was not called
__constructor: function (mask) {···
this.__base();
this._mask = mask;
},
__constructor: function (mask) {
this.__base();
this._mask = mask;
},
Function (anonymous_550)
✗ Was not called
getMask: function () {···
return this._mask;
}
getMask: function () {
return this._mask;
}
});
task-config.js
/**
* TaskConfig
* ==========
*/
var inherit = require('inherit');
var childProcess = require('child_process');
var Vow = require('vow');
/**
* TaskConfig — конфигуратор таска.
* @name TaskConfig
*/
module.exports = inherit(require('./configurable'), {
/**
* Конструктор.
* @param {String} name Имя таска.
*/
Function (anonymous_551)
✗ Was not called
__constructor: function (name) {···
this.__base();
this._name = name;
this._makePlatform = null;
this._logger = null;
},
__constructor: function (name) {
this.__base();
this._name = name;
this._makePlatform = null;
this._logger = null;
},
Function (anonymous_552)
✗ Was not called
getMakePlatform: function () {···
return this._makePlatform;
},
getMakePlatform: function () {
return this._makePlatform;
},
Function (anonymous_553)
✗ Was not called
setMakePlatform: function (makePlatform) {···
this._makePlatform = makePlatform;
this._logger = makePlatform.getLogger().subLogger(':' + this._name);
},
setMakePlatform: function (makePlatform) {
this._makePlatform = makePlatform;
this._logger = makePlatform.getLogger().subLogger(':' + this._name);
},
/**
* Логгирует сообщение в консоль.
* @param {String} msg
*/
Function (anonymous_554)
✗ Was not called
log: function (msg) {···
this._logger.log(msg);
},
log: function (msg) {
this._logger.log(msg);
},
/**
* Запускает сборку таргетов. Возвращает промис.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_555)
✗ Was not called
buildTargets: function (targets) {···
return this._makePlatform.buildTargets(targets);
},
buildTargets: function (targets) {
return this._makePlatform.buildTargets(targets);
},
/**
* Запускает сборку таргета. Возвращает промис.
* @param {String} target
* @returns {Promise}
*/
Function (anonymous_556)
✗ Was not called
buildTarget: function (target) {···
return this.buildTargets([target]);
},
buildTarget: function (target) {
return this.buildTargets([target]);
},
/**
* Запускает удаление таргетов. Возвращает промис.
* @param {String[]} targets
* @returns {Promise}
*/
Function (anonymous_557)
✗ Was not called
cleanTargets: function (targets) {···
return this._makePlatform.cleanTargets(targets);
},
cleanTargets: function (targets) {
return this._makePlatform.cleanTargets(targets);
},
/**
* Запускает удаление таргета. Возвращает промис.
* @param {String} target
* @returns {Promise}
*/
Function (anonymous_558)
✗ Was not called
cleanTarget: function (target) {···
return this.cleanTargets([target]);
},
cleanTarget: function (target) {
return this.cleanTargets([target]);
},
/**
* Выполняет shell-команду. Возвращает промис.
* @param {String} shellCmd
* @param {Object} opts
* @returns {Promise}
*/
Function (anonymous_559)
✗ Was not called
shell: function (shellCmd, opts) {···
opts = opts || {};
var env = {};
var specifiedEnv = opts.env || {};
var baseEnv = this._makePlatform.getEnv() || {};

Object.keys(baseEnv).forEach(function (key) {
env[key] = baseEnv[key];
});
Object.keys(specifiedEnv).forEach(function (key) {
env[key] = specifiedEnv[key];
});
opts.env = env;

this.log('$ ' + shellCmd);

var shellProcess = childProcess.exec(shellCmd, opts);
var promise = Vow.promise();
var stdout = '';
var stderr = '';

shellProcess.on('exit', function (code) {
if (code === 0) {
promise.fulfill([stdout, stderr]);
} else {
promise.reject(new Error(stderr));
}
});

shellProcess.stderr.on('data', function (data) {
stderr += data;
console.log(data.trim());
});

shellProcess.stdout.on('data', function (data) {
console.log(data.trim());
stdout += data;
});

return promise;
}
shell: function (shellCmd, opts) {
Branch LogicalExpression
✗ Was not returned
opts = opts || {};
✗ Was not returned
opts = opts || {};
opts = opts || {};
var env = {};
Branch LogicalExpression
✗ Was not returned
var specifiedEnv = opts.env || {};
✗ Was not returned
var specifiedEnv = opts.env || {};
var specifiedEnv = opts.env || {};
Branch LogicalExpression
✗ Was not returned
var baseEnv = this._makePlatform.getEnv() || {};
✗ Was not returned
var baseEnv = this._makePlatform.getEnv() || {};
var baseEnv = this._makePlatform.getEnv() || {};
Function (anonymous_560)
✗ Was not called
Object.keys(baseEnv).forEach(function (key) {···
env[key] = baseEnv[key];
});
Object.keys(baseEnv).forEach(function (key) {
env[key] = baseEnv[key];
});
Function (anonymous_561)
✗ Was not called
Object.keys(specifiedEnv).forEach(function (key) {···
env[key] = specifiedEnv[key];
});
Object.keys(specifiedEnv).forEach(function (key) {
env[key] = specifiedEnv[key];
});
opts.env = env;
this.log('$ ' + shellCmd);
var shellProcess = childProcess.exec(shellCmd, opts);
var promise = Vow.promise();
var stdout = '';
var stderr = '';
Function (anonymous_562)
✗ Was not called
shellProcess.on('exit', function (code) {···
if (code === 0) {
promise.fulfill([stdout, stderr]);
} else {
promise.reject(new Error(stderr));
}
});
shellProcess.on('exit', function (code) {
Branch IfStatement
✗ Positive was not executed (if)
if (code === 0) {···
promise.fulfill([stdout, stderr]);
} else {
✗ Negative was not executed (else)
} else {···
promise.reject(new Error(stderr));
}
if (code === 0) {
promise.fulfill([stdout, stderr]);
} else {
promise.reject(new Error(stderr));
}
});
Function (anonymous_563)
✗ Was not called
shellProcess.stderr.on('data', function (data) {···
stderr += data;
console.log(data.trim());
});
shellProcess.stderr.on('data', function (data) {
stderr += data;
console.log(data.trim());
});
Function (anonymous_564)
✗ Was not called
shellProcess.stdout.on('data', function (data) {···
console.log(data.trim());
stdout += data;
});
shellProcess.stdout.on('data', function (data) {
console.log(data.trim());
stdout += data;
});
return promise;
}
});
dir-glob.js
/**
* dir-glob
* ========
*
* Утилита для выбора директорий по маске. Например, 'pages/*' -> ['pages/index', 'pages/login'].
*/
var fs = require('fs');
module.exports = {
/**
* Выбирает директории по маске.
* @param {String} path
* @returns {String[]}
*/
Function (anonymous_565)
✓ Was called
globSync: function (path) {···
path = path.replace(/\/$/, '').replace(/^\//, '');
var pathBits = path.split('/');
var matched = [''];
var pathBit;
var matchedItem;
function filterDirectories(dirName) {
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {
return false;
}
if (dirName.match(expr)) {
var fullPath = matchedItem + '/' + dirName;
return fs.statSync(fullPath).isDirectory();
} else {
return false;
}
}
function buildPath(dirName) {
return matchedItem + '/' + dirName;
}
var newMatched;
while (!!(pathBit = pathBits.shift())) {
newMatched = [];
for (var i = 0, l = matched.length; i < l; i++) {
matchedItem = matched[i];
if (~pathBit.indexOf('*')) {
var expr = new RegExp(pathBit.split('*').map(escapeRegex).join('.*'));
newMatched = newMatched.concat(
fs.readdirSync(matchedItem || '/')
.filter(filterDirectories)
.map(buildPath)
);
} else {
var isWinStart = /^\w{1}:/.test(pathBit);
matchedItem += isWinStart ? pathBit : '/' + pathBit;
if (fs.existsSync(matchedItem)) {
newMatched.push(matchedItem);
}
}
}
matched = newMatched;
}
return matched;
}
globSync: function (path) {
path = path.replace(/\/$/, '').replace(/^\//, '');
var pathBits = path.split('/');
var matched = [''];
var pathBit;
var matchedItem;
Function filterDirectories
✓ Was called
function filterDirectories(dirName) {···
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {
return false;
}
if (dirName.match(expr)) {
var fullPath = matchedItem + '/' + dirName;
return fs.statSync(fullPath).isDirectory();
} else {
return false;
}
}
function filterDirectories(dirName) {
Branch IfStatement
✗ Positive was not executed (if)
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {···
return false;
}
✓ Negative was executed (else)
}···
if (dirName.match(expr)) {
Branch LogicalExpression
✓ Was returned
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {
✗ Was not returned
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {
if (dirName.charAt(0) === '.' || dirName.charAt(0) === '~') {
return false;
}
Branch IfStatement
✓ Positive was executed (if)
if (dirName.match(expr)) {···
var fullPath = matchedItem + '/' + dirName;
return fs.statSync(fullPath).isDirectory();
} else {
✗ Negative was not executed (else)
} else {···
return false;
}
if (dirName.match(expr)) {
var fullPath = matchedItem + '/' + dirName;
return fs.statSync(fullPath).isDirectory();
} else {
return false;
}
}
Function buildPath
✓ Was called
function buildPath(dirName) {···
return matchedItem + '/' + dirName;
}
function buildPath(dirName) {
return matchedItem + '/' + dirName;
}
var newMatched;
while (!!(pathBit = pathBits.shift())) {
newMatched = [];
for (var i = 0, l = matched.length; i < l; i++) {
matchedItem = matched[i];
Branch IfStatement
✓ Positive was executed (if)
if (~pathBit.indexOf('*')) {···
var expr = new RegExp(pathBit.split('*').map(escapeRegex).join('.*'));
newMatched = newMatched.concat(
fs.readdirSync(matchedItem || '/')
.filter(filterDirectories)
.map(buildPath)
);
} else {
✓ Negative was executed (else)
} else {···
var isWinStart = /^\w{1}:/.test(pathBit);
matchedItem += isWinStart ? pathBit : '/' + pathBit;
if (fs.existsSync(matchedItem)) {
newMatched.push(matchedItem);
}
}
if (~pathBit.indexOf('*')) {
var expr = new RegExp(pathBit.split('*').map(escapeRegex).join('.*'));
newMatched = newMatched.concat(
Branch LogicalExpression
✗ Was not returned
fs.readdirSync(matchedItem || '/')
✓ Was returned
fs.readdirSync(matchedItem || '/')
fs.readdirSync(matchedItem || '/')
.filter(filterDirectories)
.map(buildPath)
);
} else {
var isWinStart = /^\w{1}:/.test(pathBit);
Branch ConditionalExpression
✗ Positive was not returned (? ...)
matchedItem += isWinStart ? pathBit : '/' + pathBit;
✓ Negative was returned (: ...)
matchedItem += isWinStart ? pathBit : '/' + pathBit;
matchedItem += isWinStart ? pathBit : '/' + pathBit;
Branch IfStatement
✓ Positive was executed (if)
if (fs.existsSync(matchedItem)) {···
newMatched.push(matchedItem);
}
✗ Negative was not executed (else)
}···
}
if (fs.existsSync(matchedItem)) {
newMatched.push(matchedItem);
}
}
}
matched = newMatched;
}
return matched;
}
};
Function escapeRegex
✓ Was called
function escapeRegex(value) {···
return value.replace(/[\-\[\]{}\(\)\*\+\?\.,\\\^\$\|#]/g, '\\$&');
}
function escapeRegex(value) {
return value.replace(/[\-\[\]{}\(\)\*\+\?\.,\\\^\$\|#]/g, '\\$&');
}
build-graph.js
/**
* BuildGraph
* ==========
*
* Граф сборки. Строит граф зависимостей во время сборки.
*/
var inherit = require('inherit');
var colors = require('./colorize');
var path = require('path');
/**
* @name BuildGraph
*/
module.exports = inherit({
/**
* Конструктор.
* @param {String} caption заголовок для графа.
*/
Function (anonymous_569)
✗ Was not called
__constructor: function (caption) {···
this._caption = caption;
this._targets = {};
},
__constructor: function (caption) {
this._caption = caption;
this._targets = {};
},
/**
* Добавляет узел в граф.
* @param {String} path путь к узлу
* @param {String} tech имя технологии
*/
Function (anonymous_570)
✗ Was not called
addTarget: function (path, tech) {···
var target = this._targets[path] = this._targets[path] || {};
target.name = path;
target.tech = tech;
target.deps = target.deps || [];
target.resolved = target.resolved || false;
},
addTarget: function (path, tech) {
Branch LogicalExpression
✗ Was not returned
var target = this._targets[path] = this._targets[path] || {};
✗ Was not returned
var target = this._targets[path] = this._targets[path] || {};
var target = this._targets[path] = this._targets[path] || {};
target.name = path;
target.tech = tech;
Branch LogicalExpression
✗ Was not returned
target.deps = target.deps || [];
✗ Was not returned
target.deps = target.deps || [];
target.deps = target.deps || [];
Branch LogicalExpression
✗ Was not returned
target.resolved = target.resolved || false;
✗ Was not returned
target.resolved = target.resolved || false;
target.resolved = target.resolved || false;
},
/**
* Помечает узел, как успешно выполненный.
* В графе выводятся лишь выполненные узлы,
* чтобы не перегружать ненужной информацией.
* @param {String} path
*/
Function (anonymous_571)
✗ Was not called
resolveTarget: function (path) {···
var target = this._targets[path] = this._targets[path] || {};
target.resolved = true;
},
resolveTarget: function (path) {
Branch LogicalExpression
✗ Was not returned
var target = this._targets[path] = this._targets[path] || {};
✗ Was not returned
var target = this._targets[path] = this._targets[path] || {};
var target = this._targets[path] = this._targets[path] || {};
target.resolved = true;
},
/**
* Добавляет зависимость одного узла от другого.
* @param {String} targetPath узел
* @param {String} depFromPath зависимость узла
*/
Function (anonymous_572)
✗ Was not called
addDep: function (targetPath, depFromPath) {···
var target = this._targets[targetPath] = this._targets[targetPath] || {};
target.deps = target.deps || [];
if (target.deps.indexOf(depFromPath) === -1) {
target.deps.push(depFromPath);
}
},
addDep: function (targetPath, depFromPath) {
Branch LogicalExpression
✗ Was not returned
var target = this._targets[targetPath] = this._targets[targetPath] || {};
✗ Was not returned
var target = this._targets[targetPath] = this._targets[targetPath] || {};
var target = this._targets[targetPath] = this._targets[targetPath] || {};
Branch LogicalExpression
✗ Was not returned
target.deps = target.deps || [];
✗ Was not returned
target.deps = target.deps || [];
target.deps = target.deps || [];
Branch IfStatement
✗ Positive was not executed (if)
if (target.deps.indexOf(depFromPath) === -1) {···
target.deps.push(depFromPath);
}
✗ Negative was not executed (else)
}···
},
if (target.deps.indexOf(depFromPath) === -1) {
target.deps.push(depFromPath);
}
},
/**
* Формирует граф, пригодный для вывода в консоли.
* @returns {String}
*/
Function (anonymous_573)
✗ Was not called
render: function () {···
var res = '\n Build graph for ' + colors.bold(this._caption) + ':\n\n';
var targets = this._targets;
var nonDepTargets = {};
Object.keys(targets).forEach(function (key) {
if (targets[key].resolved) {
nonDepTargets[key] = true;
}
});
Object.keys(targets).forEach(function (key) {
targets[key].deps.forEach(function (depKey) {
delete nonDepTargets[depKey];
});
});
var _this = this;
res += Object.keys(nonDepTargets).map(function (key) {
return _this.renderTarget(key, false);
}).join('\n\n');
return res;
},
render: function () {
var res = '\n Build graph for ' + colors.bold(this._caption) + ':\n\n';
var targets = this._targets;
var nonDepTargets = {};
Function (anonymous_574)
✗ Was not called
Object.keys(targets).forEach(function (key) {···
if (targets[key].resolved) {
nonDepTargets[key] = true;
}
});
Object.keys(targets).forEach(function (key) {
Branch IfStatement
✗ Positive was not executed (if)
if (targets[key].resolved) {···
nonDepTargets[key] = true;
}
✗ Negative was not executed (else)
}···
});
if (targets[key].resolved) {
nonDepTargets[key] = true;
}
});
Function (anonymous_575)
✗ Was not called
Object.keys(targets).forEach(function (key) {···
targets[key].deps.forEach(function (depKey) {
delete nonDepTargets[depKey];
});
});
Object.keys(targets).forEach(function (key) {
Function (anonymous_576)
✗ Was not called
targets[key].deps.forEach(function (depKey) {···
delete nonDepTargets[depKey];
});
targets[key].deps.forEach(function (depKey) {
delete nonDepTargets[depKey];
});
});
var _this = this;
Function (anonymous_577)
✗ Was not called
res += Object.keys(nonDepTargets).map(function (key) {···
return _this.renderTarget(key, false);
}).join('\n\n');
res += Object.keys(nonDepTargets).map(function (key) {
return _this.renderTarget(key, false);
}).join('\n\n');
return res;
},
Function (anonymous_578)
✗ Was not called
renderPumlFragments: function () {···
var res = [];
var packageData = {};
var targets = this._targets;
Object.keys(targets).forEach(function (key) {
var target = targets[key];
var packageName = path.dirname(target.name);
var packageRes = (packageData[packageName] = packageData[packageName] || []);
packageRes.push(
'[<b>' + path.basename(target.name) + '</b>\\n' + target.tech + '] as [' + target.name + ']'
);
target.deps.forEach(function (depName) {
packageRes.push('[' + target.name + '] <-- [' + depName + ']');
});
});
Object.keys(packageData).forEach(function (packageName) {
res.push('folder [' + packageName + '] {\n' + packageData[packageName].join('\n') + '\n}');
});
return res;
},
renderPumlFragments: function () {
var res = [];
var packageData = {};
var targets = this._targets;
Function (anonymous_579)
✗ Was not called
Object.keys(targets).forEach(function (key) {···
var target = targets[key];
var packageName = path.dirname(target.name);
var packageRes = (packageData[packageName] = packageData[packageName] || []);
packageRes.push(
'[<b>' + path.basename(target.name) + '</b>\\n' + target.tech + '] as [' + target.name + ']'
);
target.deps.forEach(function (depName) {
packageRes.push('[' + target.name + '] <-- [' + depName + ']');
});
});
Object.keys(targets).forEach(function (key) {
var target = targets[key];
var packageName = path.dirname(target.name);
Branch LogicalExpression
✗ Was not returned
var packageRes = (packageData[packageName] = packageData[packageName] || []);
✗ Was not returned
var packageRes = (packageData[packageName] = packageData[packageName] || []);
var packageRes = (packageData[packageName] = packageData[packageName] || []);
packageRes.push(
'[<b>' + path.basename(target.name) + '</b>\\n' + target.tech + '] as [' + target.name + ']'
);
Function (anonymous_580)
✗ Was not called
target.deps.forEach(function (depName) {···
packageRes.push('[' + target.name + '] <-- [' + depName + ']');
});
target.deps.forEach(function (depName) {
packageRes.push('[' + target.name + '] <-- [' + depName + ']');
});
});
Function (anonymous_581)
✗ Was not called
Object.keys(packageData).forEach(function (packageName) {···
res.push('folder [' + packageName + '] {\n' + packageData[packageName].join('\n') + '\n}');
});
Object.keys(packageData).forEach(function (packageName) {
res.push('folder [' + packageName + '] {\n' + packageData[packageName].join('\n') + '\n}');
});
return res;
},
Function (anonymous_582)
✗ Was not called
renderFragmentedPumlLinks: function () {···
var pumlLink = require('puml-link');
return this.renderPumlFragments().map(function (fragment) {
return pumlLink.generatePumlUrl(fragment);
});
},
renderFragmentedPumlLinks: function () {
var pumlLink = require('puml-link');
Function (anonymous_583)
✗ Was not called
return this.renderPumlFragments().map(function (fragment) {···
return pumlLink.generatePumlUrl(fragment);
});
return this.renderPumlFragments().map(function (fragment) {
return pumlLink.generatePumlUrl(fragment);
});
},
/**
* Формирует текст узла графа.
* @param {String} targetName узел
* @param {String} sub является ли узел дочерним
* @returns {string}
*/
Function (anonymous_584)
✗ Was not called
renderTarget: function (targetName, sub) {···
var targets = this._targets;
var target = targets[targetName];
var _this = this;
var subTargetsRendered = target.deps.map(function (dep) {
return _this.renderTarget(dep, true);
});
var targetInfo = (sub ? '- ' : '') + path.basename(target.name);
var targetDir = (sub ? ' ' : '') + path.dirname(target.name);
if (targetDir.length > targetInfo.length) {
targetInfo += (new Array(targetDir.length - targetInfo.length + 1)).join(' ');
}
if (targetInfo.length > targetDir.length) {
targetDir += (new Array(targetInfo.length - targetDir.length + 1)).join(' ');
}
if (subTargetsRendered.length > 0) {
var larr = ' <-';
var targetInfoLen = targetInfo.length + larr.length;
targetInfo = targetInfo + colors.grey(larr);
var subTargetsLines = subTargetsRendered.join('\n\n').split('\n');
var doIndent = false;
var indentStarted = false;
for (var i = 0, l = subTargetsLines.length; i < l; i++) {
var indentSym = subTargetsRendered.length === 1 ? ' ' : '|';
var joinSym = subTargetsRendered.length === 1 ? '-' : '+';
var line = subTargetsLines[i];
if (line.charAt(0) === '-') {
indentSym = '+';
line = colors.grey('-') + line.substr(1);
if (!doIndent) {
doIndent = true;
indentStarted = true;
}
} else {
if (indentStarted) {
doIndent = false;
for (var j = i; j < l; j++) {
if (subTargetsLines[j].charAt(0) === '-') {
doIndent = true;
}
}
}
}
var indent = doIndent ? indentSym : ' ';
if (i === Math.floor(l / 2) - 1) {
subTargetsLines[i] = targetInfo + colors.grey(joinSym) + line;
} else if (i === Math.floor(l / 2)) {
subTargetsLines[i] = colors.grey(targetDir) + ' ' + colors.grey(indent) + line;
} else {
subTargetsLines[i] = new Array(targetInfoLen + 1).join(' ') + colors.grey(indent) + line;
}
}
return subTargetsLines.join('\n');
}

return targetInfo + '\n' + colors.grey(targetDir);
}
renderTarget: function (targetName, sub) {
var targets = this._targets;
var target = targets[targetName];
var _this = this;
Function (anonymous_585)
✗ Was not called
var subTargetsRendered = target.deps.map(function (dep) {···
return _this.renderTarget(dep, true);
});
var subTargetsRendered = target.deps.map(function (dep) {
return _this.renderTarget(dep, true);
});
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var targetInfo = (sub ? '- ' : '') + path.basename(target.name);
✗ Negative was not returned (: ...)
var targetInfo = (sub ? '- ' : '') + path.basename(target.name);
var targetInfo = (sub ? '- ' : '') + path.basename(target.name);
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var targetDir = (sub ? ' ' : '') + path.dirname(target.name);
✗ Negative was not returned (: ...)
var targetDir = (sub ? ' ' : '') + path.dirname(target.name);
var targetDir = (sub ? ' ' : '') + path.dirname(target.name);
Branch IfStatement
✗ Positive was not executed (if)
if (targetDir.length > targetInfo.length) {···
targetInfo += (new Array(targetDir.length - targetInfo.length + 1)).join(' ');
}
✗ Negative was not executed (else)
}···
if (targetInfo.length > targetDir.length) {
if (targetDir.length > targetInfo.length) {
targetInfo += (new Array(targetDir.length - targetInfo.length + 1)).join(' ');
}
Branch IfStatement
✗ Positive was not executed (if)
if (targetInfo.length > targetDir.length) {···
targetDir += (new Array(targetInfo.length - targetDir.length + 1)).join(' ');
}
✗ Negative was not executed (else)
}···
if (subTargetsRendered.length > 0) {
if (targetInfo.length > targetDir.length) {
targetDir += (new Array(targetInfo.length - targetDir.length + 1)).join(' ');
}
Branch IfStatement
✗ Positive was not executed (if)
if (subTargetsRendered.length > 0) {···
var larr = ' <-';
var targetInfoLen = targetInfo.length + larr.length;
targetInfo = targetInfo + colors.grey(larr);
var subTargetsLines = subTargetsRendered.join('\n\n').split('\n');
var doIndent = false;
var indentStarted = false;
for (var i = 0, l = subTargetsLines.length; i < l; i++) {
var indentSym = subTargetsRendered.length === 1 ? ' ' : '|';
var joinSym = subTargetsRendered.length === 1 ? '-' : '+';
var line = subTargetsLines[i];
if (line.charAt(0) === '-') {
indentSym = '+';
line = colors.grey('-') + line.substr(1);
if (!doIndent) {
doIndent = true;
indentStarted = true;
}
} else {
if (indentStarted) {
doIndent = false;
for (var j = i; j < l; j++) {
if (subTargetsLines[j].charAt(0) === '-') {
doIndent = true;
}
}
}
}
var indent = doIndent ? indentSym : ' ';
if (i === Math.floor(l / 2) - 1) {
subTargetsLines[i] = targetInfo + colors.grey(joinSym) + line;
} else if (i === Math.floor(l / 2)) {
subTargetsLines[i] = colors.grey(targetDir) + ' ' + colors.grey(indent) + line;
} else {
subTargetsLines[i] = new Array(targetInfoLen + 1).join(' ') + colors.grey(indent) + line;
}
}
return subTargetsLines.join('\n');
}
✗ Negative was not executed (else)
}···

return targetInfo + '\n' + colors.grey(targetDir);
if (subTargetsRendered.length > 0) {
var larr = ' <-';
var targetInfoLen = targetInfo.length + larr.length;
targetInfo = targetInfo + colors.grey(larr);
var subTargetsLines = subTargetsRendered.join('\n\n').split('\n');
var doIndent = false;
var indentStarted = false;
for (var i = 0, l = subTargetsLines.length; i < l; i++) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var indentSym = subTargetsRendered.length === 1 ? ' ' : '|';
✗ Negative was not returned (: ...)
var indentSym = subTargetsRendered.length === 1 ? ' ' : '|';
var indentSym = subTargetsRendered.length === 1 ? ' ' : '|';
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var joinSym = subTargetsRendered.length === 1 ? '-' : '+';
✗ Negative was not returned (: ...)
var joinSym = subTargetsRendered.length === 1 ? '-' : '+';
var joinSym = subTargetsRendered.length === 1 ? '-' : '+';
var line = subTargetsLines[i];
Branch IfStatement
✗ Positive was not executed (if)
if (line.charAt(0) === '-') {···
indentSym = '+';
line = colors.grey('-') + line.substr(1);
if (!doIndent) {
doIndent = true;
indentStarted = true;
}
} else {
✗ Negative was not executed (else)
} else {···
if (indentStarted) {
doIndent = false;
for (var j = i; j < l; j++) {
if (subTargetsLines[j].charAt(0) === '-') {
doIndent = true;
}
}
}
}
if (line.charAt(0) === '-') {
indentSym = '+';
line = colors.grey('-') + line.substr(1);
Branch IfStatement
✗ Positive was not executed (if)
if (!doIndent) {···
doIndent = true;
indentStarted = true;
}
✗ Negative was not executed (else)
}···
} else {
if (!doIndent) {
doIndent = true;
indentStarted = true;
}
} else {
Branch IfStatement
✗ Positive was not executed (if)
if (indentStarted) {···
doIndent = false;
for (var j = i; j < l; j++) {
if (subTargetsLines[j].charAt(0) === '-') {
doIndent = true;
}
}
}
✗ Negative was not executed (else)
}···
}
if (indentStarted) {
doIndent = false;
for (var j = i; j < l; j++) {
Branch IfStatement
✗ Positive was not executed (if)
if (subTargetsLines[j].charAt(0) === '-') {···
doIndent = true;
}
✗ Negative was not executed (else)
}···
}
if (subTargetsLines[j].charAt(0) === '-') {
doIndent = true;
}
}
}
}
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var indent = doIndent ? indentSym : ' ';
✗ Negative was not returned (: ...)
var indent = doIndent ? indentSym : ' ';
var indent = doIndent ? indentSym : ' ';
Branch IfStatement
✗ Positive was not executed (if)
if (i === Math.floor(l / 2) - 1) {···
subTargetsLines[i] = targetInfo + colors.grey(joinSym) + line;
} else if (i === Math.floor(l / 2)) {
✗ Negative was not executed (else)
} else if (i === Math.floor(l / 2)) {···
subTargetsLines[i] = colors.grey(targetDir) + ' ' + colors.grey(indent) + line;
} else {
subTargetsLines[i] = new Array(targetInfoLen + 1).join(' ') + colors.grey(indent) + line;
}
if (i === Math.floor(l / 2) - 1) {
subTargetsLines[i] = targetInfo + colors.grey(joinSym) + line;
Branch IfStatement
✗ Positive was not executed (if)
} else if (i === Math.floor(l / 2)) {···
subTargetsLines[i] = colors.grey(targetDir) + ' ' + colors.grey(indent) + line;
} else {
✗ Negative was not executed (else)
} else {···
subTargetsLines[i] = new Array(targetInfoLen + 1).join(' ') + colors.grey(indent) + line;
}
} else if (i === Math.floor(l / 2)) {
subTargetsLines[i] = colors.grey(targetDir) + ' ' + colors.grey(indent) + line;
} else {
subTargetsLines[i] = new Array(targetInfoLen + 1).join(' ') + colors.grey(indent) + line;
}
}
return subTargetsLines.join('\n');
}
return targetInfo + '\n' + colors.grey(targetDir);
}
});
server.js
/**
* CLI/server
* ========
*
* Этот файл запускает ENB-сервер из командной строки.
*/
var cdir = process.cwd();
var Server = require('../server/server');
var Vow = require('vow');
module.exports = function (program) {
program
.command('server')
.description('run development server')
.option('-p, --port <port>', 'socket port [8080]')
.option('-h, --host <host>', 'socket host [0.0.0.0]')
.option('-s, --socket <socket>', 'unix socket path')
Function (anonymous_587)
✗ Was not called
.action(function (options) {···
var opts = {
port: options.port || 8080,
host: options.host || '0.0.0.0',
socket: options.socket
};
var server = new Server();
Vow.when(server.init(cdir, opts)).then((function () {
return server.run();
})).then(null, function (err) {
console.error(err.stack);
process.exit(1);
});
});
.action(function (options) {
var opts = {
Branch LogicalExpression
✗ Was not returned
port: options.port || 8080,
✗ Was not returned
port: options.port || 8080,
port: options.port || 8080,
Branch LogicalExpression
✗ Was not returned
host: options.host || '0.0.0.0',
✗ Was not returned
host: options.host || '0.0.0.0',
host: options.host || '0.0.0.0',
socket: options.socket
};
var server = new Server();
Function (anonymous_588)
✗ Was not called
Vow.when(server.init(cdir, opts)).then((function () {···
return server.run();
})).then(null, function (err) {
Vow.when(server.init(cdir, opts)).then((function () {
return server.run();
Function (anonymous_589)
✗ Was not called
})).then(null, function (err) {···
console.error(err.stack);
process.exit(1);
});
})).then(null, function (err) {
console.error(err.stack);
process.exit(1);
});
});
};
server.js
/**
* Server
* ======
*/
var inherit = require('inherit');
var MakePlatform = require('../make');
var middleware = require('./server-middleware');
var connect = require('connect');
var serveStatic = require('serve-static');
var fs = require('fs');
var path = require('path');
/**
* Server умеет запускать web-сервер на основе connect, обрабатывая запросы с помощью ENB.
* @name Server
*/
module.exports = inherit({
Function (anonymous_590)
✗ Was not called
init: function (cdir, options) {···
this._port = options.port;
this._host = options.host;
this._socket = options.socket;
this._options = options;
this._options.cdir = cdir;
},
init: function (cdir, options) {
this._port = options.port;
this._host = options.host;
this._socket = options.socket;
this._options = options;
this._options.cdir = cdir;
},
Function (anonymous_591)
✗ Was not called
run: function () {···
var _this = this;
var app = connect();

app.use(middleware.createMiddleware(_this._options));
app.use(serveStatic(_this._options.cdir));
app.use(function (req, res, next) {
if (req.method === 'GET' && req.url === '/') {
_this._indexPage(req, res);
} else {
next();
}
});
process.on('uncaughtException', function (err) {
console.log(err.stack);
});
var socket;
function serverStarted() {
console.log('Server started at ' + socket);
}
if (_this._socket) {
try {
fs.unlinkSync(_this._socket);
} catch (e) {}
socket = _this._socket;
app.listen(_this._socket, function () {
fs.chmod(_this._socket, '0777');
serverStarted();
});
} else {
socket = 'http://' + _this._host + ':' + _this._port;
app.listen(_this._port, _this._host, serverStarted);
}
},
run: function () {
var _this = this;
var app = connect();
app.use(middleware.createMiddleware(_this._options));
app.use(serveStatic(_this._options.cdir));
Function (anonymous_592)
✗ Was not called
app.use(function (req, res, next) {···
if (req.method === 'GET' && req.url === '/') {
_this._indexPage(req, res);
} else {
next();
}
});
app.use(function (req, res, next) {
Branch IfStatement
✗ Positive was not executed (if)
if (req.method === 'GET' && req.url === '/') {···
_this._indexPage(req, res);
} else {
✗ Negative was not executed (else)
} else {···
next();
}
Branch LogicalExpression
✗ Was not returned
if (req.method === 'GET' && req.url === '/') {
✗ Was not returned
if (req.method === 'GET' && req.url === '/') {
if (req.method === 'GET' && req.url === '/') {
_this._indexPage(req, res);
} else {
next();
}
});
Function (anonymous_593)
✗ Was not called
process.on('uncaughtException', function (err) {···
console.log(err.stack);
});
process.on('uncaughtException', function (err) {
console.log(err.stack);
});
var socket;
Function serverStarted
✗ Was not called
function serverStarted() {···
console.log('Server started at ' + socket);
}
function serverStarted() {
console.log('Server started at ' + socket);
}
Branch IfStatement
✗ Positive was not executed (if)
if (_this._socket) {···
try {
fs.unlinkSync(_this._socket);
} catch (e) {}
socket = _this._socket;
app.listen(_this._socket, function () {
fs.chmod(_this._socket, '0777');
serverStarted();
});
} else {
✗ Negative was not executed (else)
} else {···
socket = 'http://' + _this._host + ':' + _this._port;
app.listen(_this._port, _this._host, serverStarted);
}
if (_this._socket) {
try {
fs.unlinkSync(_this._socket);
} catch (e) {}
socket = _this._socket;
Function (anonymous_595)
✗ Was not called
app.listen(_this._socket, function () {···
fs.chmod(_this._socket, '0777');
serverStarted();
});
app.listen(_this._socket, function () {
fs.chmod(_this._socket, '0777');
serverStarted();
});
} else {
socket = 'http://' + _this._host + ':' + _this._port;
app.listen(_this._port, _this._host, serverStarted);
}
},
Function (anonymous_596)
✗ Was not called
_indexPage: function (req, res) {···
var projectName = path.basename(this._options.cdir || process.cwd());
var makePlatform = new MakePlatform();
makePlatform.init(this._options.cdir).done(function () {
makePlatform.loadCache();
return makePlatform.buildTargets([]).then(function () {
var htmlPages = [];
var nodeConfigs = makePlatform.getProjectConfig().getNodeConfigs();
Object.keys(nodeConfigs).forEach(function (nodeConfigPath) {
var nodeConfig = nodeConfigs[nodeConfigPath];
nodeConfig.getTargets().forEach(function (target) {
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
});

var html = ['<!DOCTYPE HTML>'];
html.push('<html>');
html.push('<head>');
html.push(' <title>' + projectName + '</title>');
html.push(' <style>');
html.push(
'body {' +
' margin: 0;' +
' padding: 80px 100px;' +
' font: 13px "Helvetica Neue", "Lucida Grande", "Arial";' +
' background: #fff;' +
' background-repeat: no-repeat;' +
' color: #555;' +
' -webkit-font-smoothing: antialiased;' +
'}'
);
html.push(
'h1 {' +
' margin: 0;' +
' font-size: 60px;' +
' color: #343434;' +
'}'
);
html.push(
'h2 {' +
' margin: 40px 0px 10px;' +
' font-size: 20px;' +
' color: #343434;' +
'}'
);
html.push(
'a {' +
' color: #555;' +
'}' +
'a:hover {' +
' color: #303030;' +
'}'
);
html.push(
'ul {' +
' margin: 0;' +
' padding: 0;' +
'}' +
'ul li {' +
' margin: 5px 0;' +
' list-style: none;' +
' font-size: 16px;' +
'}' +
'ul li a:before {' +
' display: inline-block;' +
' width: 16px;' +
' height: 16px;' +
' background: url(data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0ElEQVR42o2TzwqCQBCHfaneplOHrj1AB5+' +
'iNwg6R50Cjd4ggv4JhXfB27IK5uRvQNjGdseBjx1m5/cpghERMXEc0wiWHRHocz+Cuq7JWjugqipXsvAKUF' +
'mWSTBGsD8/HTOvIM9zSR90sV5BURQDRLHEKyjLMoQuMMYw1/PtX68L8MUP24SmkzndL0+AHjPc6YJkd0SAz' +
'6ZpgDsLC16PNy+uVxsShRnusBN+g3R/wiKfXMOZVyADeBoQQl2AQlD2ukApXYCfqW3bENjxC8biCr5jjTCh' +
'qbabBgAAAABJRU5ErkJggg==);' +
' margin-right: 5px;' +
' content: "";' +
' vertical-align: bottom;' +
'}'
);
html.push(' </style>');
html.push('</head>');
html.push('<body>');
html.push('<h1>' + projectName + '</h1>');
if (htmlPages.length > 0) {
html.push('<h2>Available pages</h2>');
html.push('<ul>');
htmlPages.forEach(function (htmlPage) {
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
html.push('</ul>');
} else {
html.push('No pages are configured');
}
html.push('<h2>Graph</h2>');

html.push('<ul>');
makePlatform.getBuildGraph().renderFragmentedPumlLinks().forEach(function (graphLink) {
html.push(
'<li>' +
'<img src="' + graphLink + '" />' +
'</li>'
);
});
html.push('</ul>');
html.push('<h2>More info</h2>');
html.push('<div><a href="https://github.com/enb-make/enb">ENB Readme</a></div>');
html.push('</body>');
html.push('</html>');
res.end(html.join('\n'));
});
});
}
_indexPage: function (req, res) {
Branch LogicalExpression
✗ Was not returned
var projectName = path.basename(this._options.cdir || process.cwd());
✗ Was not returned
var projectName = path.basename(this._options.cdir || process.cwd());
var projectName = path.basename(this._options.cdir || process.cwd());
var makePlatform = new MakePlatform();
Function (anonymous_597)
✗ Was not called
makePlatform.init(this._options.cdir).done(function () {···
makePlatform.loadCache();
return makePlatform.buildTargets([]).then(function () {
var htmlPages = [];
var nodeConfigs = makePlatform.getProjectConfig().getNodeConfigs();
Object.keys(nodeConfigs).forEach(function (nodeConfigPath) {
var nodeConfig = nodeConfigs[nodeConfigPath];
nodeConfig.getTargets().forEach(function (target) {
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
});

var html = ['<!DOCTYPE HTML>'];
html.push('<html>');
html.push('<head>');
html.push(' <title>' + projectName + '</title>');
html.push(' <style>');
html.push(
'body {' +
' margin: 0;' +
' padding: 80px 100px;' +
' font: 13px "Helvetica Neue", "Lucida Grande", "Arial";' +
' background: #fff;' +
' background-repeat: no-repeat;' +
' color: #555;' +
' -webkit-font-smoothing: antialiased;' +
'}'
);
html.push(
'h1 {' +
' margin: 0;' +
' font-size: 60px;' +
' color: #343434;' +
'}'
);
html.push(
'h2 {' +
' margin: 40px 0px 10px;' +
' font-size: 20px;' +
' color: #343434;' +
'}'
);
html.push(
'a {' +
' color: #555;' +
'}' +
'a:hover {' +
' color: #303030;' +
'}'
);
html.push(
'ul {' +
' margin: 0;' +
' padding: 0;' +
'}' +
'ul li {' +
' margin: 5px 0;' +
' list-style: none;' +
' font-size: 16px;' +
'}' +
'ul li a:before {' +
' display: inline-block;' +
' width: 16px;' +
' height: 16px;' +
' background: url(data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0ElEQVR42o2TzwqCQBCHfaneplOHrj1AB5+' +
'iNwg6R50Cjd4ggv4JhXfB27IK5uRvQNjGdseBjx1m5/cpghERMXEc0wiWHRHocz+Cuq7JWjugqipXsvAKUF' +
'mWSTBGsD8/HTOvIM9zSR90sV5BURQDRLHEKyjLMoQuMMYw1/PtX68L8MUP24SmkzndL0+AHjPc6YJkd0SAz' +
'6ZpgDsLC16PNy+uVxsShRnusBN+g3R/wiKfXMOZVyADeBoQQl2AQlD2ukApXYCfqW3bENjxC8biCr5jjTCh' +
'qbabBgAAAABJRU5ErkJggg==);' +
' margin-right: 5px;' +
' content: "";' +
' vertical-align: bottom;' +
'}'
);
html.push(' </style>');
html.push('</head>');
html.push('<body>');
html.push('<h1>' + projectName + '</h1>');
if (htmlPages.length > 0) {
html.push('<h2>Available pages</h2>');
html.push('<ul>');
htmlPages.forEach(function (htmlPage) {
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
html.push('</ul>');
} else {
html.push('No pages are configured');
}
html.push('<h2>Graph</h2>');

html.push('<ul>');
makePlatform.getBuildGraph().renderFragmentedPumlLinks().forEach(function (graphLink) {
html.push(
'<li>' +
'<img src="' + graphLink + '" />' +
'</li>'
);
});
html.push('</ul>');
html.push('<h2>More info</h2>');
html.push('<div><a href="https://github.com/enb-make/enb">ENB Readme</a></div>');
html.push('</body>');
html.push('</html>');
res.end(html.join('\n'));
});
});
makePlatform.init(this._options.cdir).done(function () {
makePlatform.loadCache();
Function (anonymous_598)
✗ Was not called
return makePlatform.buildTargets([]).then(function () {···
var htmlPages = [];
var nodeConfigs = makePlatform.getProjectConfig().getNodeConfigs();
Object.keys(nodeConfigs).forEach(function (nodeConfigPath) {
var nodeConfig = nodeConfigs[nodeConfigPath];
nodeConfig.getTargets().forEach(function (target) {
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
});

var html = ['<!DOCTYPE HTML>'];
html.push('<html>');
html.push('<head>');
html.push(' <title>' + projectName + '</title>');
html.push(' <style>');
html.push(
'body {' +
' margin: 0;' +
' padding: 80px 100px;' +
' font: 13px "Helvetica Neue", "Lucida Grande", "Arial";' +
' background: #fff;' +
' background-repeat: no-repeat;' +
' color: #555;' +
' -webkit-font-smoothing: antialiased;' +
'}'
);
html.push(
'h1 {' +
' margin: 0;' +
' font-size: 60px;' +
' color: #343434;' +
'}'
);
html.push(
'h2 {' +
' margin: 40px 0px 10px;' +
' font-size: 20px;' +
' color: #343434;' +
'}'
);
html.push(
'a {' +
' color: #555;' +
'}' +
'a:hover {' +
' color: #303030;' +
'}'
);
html.push(
'ul {' +
' margin: 0;' +
' padding: 0;' +
'}' +
'ul li {' +
' margin: 5px 0;' +
' list-style: none;' +
' font-size: 16px;' +
'}' +
'ul li a:before {' +
' display: inline-block;' +
' width: 16px;' +
' height: 16px;' +
' background: url(data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0ElEQVR42o2TzwqCQBCHfaneplOHrj1AB5+' +
'iNwg6R50Cjd4ggv4JhXfB27IK5uRvQNjGdseBjx1m5/cpghERMXEc0wiWHRHocz+Cuq7JWjugqipXsvAKUF' +
'mWSTBGsD8/HTOvIM9zSR90sV5BURQDRLHEKyjLMoQuMMYw1/PtX68L8MUP24SmkzndL0+AHjPc6YJkd0SAz' +
'6ZpgDsLC16PNy+uVxsShRnusBN+g3R/wiKfXMOZVyADeBoQQl2AQlD2ukApXYCfqW3bENjxC8biCr5jjTCh' +
'qbabBgAAAABJRU5ErkJggg==);' +
' margin-right: 5px;' +
' content: "";' +
' vertical-align: bottom;' +
'}'
);
html.push(' </style>');
html.push('</head>');
html.push('<body>');
html.push('<h1>' + projectName + '</h1>');
if (htmlPages.length > 0) {
html.push('<h2>Available pages</h2>');
html.push('<ul>');
htmlPages.forEach(function (htmlPage) {
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
html.push('</ul>');
} else {
html.push('No pages are configured');
}
html.push('<h2>Graph</h2>');

html.push('<ul>');
makePlatform.getBuildGraph().renderFragmentedPumlLinks().forEach(function (graphLink) {
html.push(
'<li>' +
'<img src="' + graphLink + '" />' +
'</li>'
);
});
html.push('</ul>');
html.push('<h2>More info</h2>');
html.push('<div><a href="https://github.com/enb-make/enb">ENB Readme</a></div>');
html.push('</body>');
html.push('</html>');
res.end(html.join('\n'));
});
return makePlatform.buildTargets([]).then(function () {
var htmlPages = [];
var nodeConfigs = makePlatform.getProjectConfig().getNodeConfigs();
Function (anonymous_599)
✗ Was not called
Object.keys(nodeConfigs).forEach(function (nodeConfigPath) {···
var nodeConfig = nodeConfigs[nodeConfigPath];
nodeConfig.getTargets().forEach(function (target) {
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
});
Object.keys(nodeConfigs).forEach(function (nodeConfigPath) {
var nodeConfig = nodeConfigs[nodeConfigPath];
Function (anonymous_600)
✗ Was not called
nodeConfig.getTargets().forEach(function (target) {···
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
nodeConfig.getTargets().forEach(function (target) {
Branch IfStatement
✗ Positive was not executed (if)
if (target.match(/\.html$/)) {···
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
✗ Negative was not executed (else)
}···
});
if (target.match(/\.html$/)) {
htmlPages.push(nodeConfig.getPath() + '/' + target);
}
});
});
var html = ['<!DOCTYPE HTML>'];
html.push('<html>');
html.push('<head>');
html.push(' <title>' + projectName + '</title>');
html.push(' <style>');
html.push(
'body {' +
' margin: 0;' +
' padding: 80px 100px;' +
' font: 13px "Helvetica Neue", "Lucida Grande", "Arial";' +
' background: #fff;' +
' background-repeat: no-repeat;' +
' color: #555;' +
' -webkit-font-smoothing: antialiased;' +
'}'
);
html.push(
'h1 {' +
' margin: 0;' +
' font-size: 60px;' +
' color: #343434;' +
'}'
);
html.push(
'h2 {' +
' margin: 40px 0px 10px;' +
' font-size: 20px;' +
' color: #343434;' +
'}'
);
html.push(
'a {' +
' color: #555;' +
'}' +
'a:hover {' +
' color: #303030;' +
'}'
);
html.push(
'ul {' +
' margin: 0;' +
' padding: 0;' +
'}' +
'ul li {' +
' margin: 5px 0;' +
' list-style: none;' +
' font-size: 16px;' +
'}' +
'ul li a:before {' +
' display: inline-block;' +
' width: 16px;' +
' height: 16px;' +
' background: url(data:image/png;base64,' +
'iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAA0ElEQVR42o2TzwqCQBCHfaneplOHrj1AB5+' +
'iNwg6R50Cjd4ggv4JhXfB27IK5uRvQNjGdseBjx1m5/cpghERMXEc0wiWHRHocz+Cuq7JWjugqipXsvAKUF' +
'mWSTBGsD8/HTOvIM9zSR90sV5BURQDRLHEKyjLMoQuMMYw1/PtX68L8MUP24SmkzndL0+AHjPc6YJkd0SAz' +
'6ZpgDsLC16PNy+uVxsShRnusBN+g3R/wiKfXMOZVyADeBoQQl2AQlD2ukApXYCfqW3bENjxC8biCr5jjTCh' +
'qbabBgAAAABJRU5ErkJggg==);' +
' margin-right: 5px;' +
' content: "";' +
' vertical-align: bottom;' +
'}'
);
html.push(' </style>');
html.push('</head>');
html.push('<body>');
html.push('<h1>' + projectName + '</h1>');
Branch IfStatement
✗ Positive was not executed (if)
if (htmlPages.length > 0) {···
html.push('<h2>Available pages</h2>');
html.push('<ul>');
htmlPages.forEach(function (htmlPage) {
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
html.push('</ul>');
} else {
✗ Negative was not executed (else)
} else {···
html.push('No pages are configured');
}
if (htmlPages.length > 0) {
html.push('<h2>Available pages</h2>');
html.push('<ul>');
Function (anonymous_601)
✗ Was not called
htmlPages.forEach(function (htmlPage) {···
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
htmlPages.forEach(function (htmlPage) {
html.push('<li><a href="' + htmlPage + '">' + htmlPage + '</a></li>');
});
html.push('</ul>');
} else {
html.push('No pages are configured');
}
html.push('<h2>Graph</h2>');
html.push('<ul>');
Function (anonymous_602)
✗ Was not called
makePlatform.getBuildGraph().renderFragmentedPumlLinks().forEach(function (graphLink) {···
html.push(
'<li>' +
'<img src="' + graphLink + '" />' +
'</li>'
);
});
makePlatform.getBuildGraph().renderFragmentedPumlLinks().forEach(function (graphLink) {
html.push(
'<li>' +
'<img src="' + graphLink + '" />' +
'</li>'
);
});
html.push('</ul>');
html.push('<h2>More info</h2>');
html.push('<div><a href="https://github.com/enb-make/enb">ENB Readme</a></div>');
html.push('</body>');
html.push('</html>');
res.end(html.join('\n'));
});
});
}
});
server-middleware.js
/**
* server-middleware
* =================
*
* Инструментарий для подключения ENB к express-приложению.
*/
var MakePlatform = require('../make');
var TargetNotFoundError = require('../errors/target-not-found-error');
var Logger = require('../logger');
var mime = require('mime');
var send = require('send');
/**
* @param {Object} options
* @param {String} options.cdir Корневая директория проекта.
* @param {Boolean} options.noLog Не логгировать в консоль процесс сборки.
* @returns {Function}
*/
Function (anonymous_603)
✗ Was not called
module.exports.createMiddleware = function (options) {···
var builder = this.createBuilder(options);
return function (req, res, next) {
var dt = new Date();
var pathname = req._parsedUrl.pathname;
builder(pathname).then(function (filename) {
try {
var mimeType = mime.lookup(filename);
var mimeCharset = mimeType === 'application/javascript' ?
'UTF-8' :
mime.charsets.lookup(mimeType, null);

res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
send(req, filename).pipe(res);
console.log('----- ' + pathname + ' ' + (new Date() - dt) + 'ms');
} catch (err) {
next(err);
}
}, function (err) {
if (err instanceof TargetNotFoundError) {
next();
} else {
next(err);
}
});
};
};
module.exports.createMiddleware = function (options) {
var builder = this.createBuilder(options);
Function (anonymous_604)
✗ Was not called
return function (req, res, next) {···
var dt = new Date();
var pathname = req._parsedUrl.pathname;
builder(pathname).then(function (filename) {
try {
var mimeType = mime.lookup(filename);
var mimeCharset = mimeType === 'application/javascript' ?
'UTF-8' :
mime.charsets.lookup(mimeType, null);

res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
send(req, filename).pipe(res);
console.log('----- ' + pathname + ' ' + (new Date() - dt) + 'ms');
} catch (err) {
next(err);
}
}, function (err) {
if (err instanceof TargetNotFoundError) {
next();
} else {
next(err);
}
});
};
return function (req, res, next) {
var dt = new Date();
var pathname = req._parsedUrl.pathname;
Function (anonymous_605)
✗ Was not called
builder(pathname).then(function (filename) {···
try {
var mimeType = mime.lookup(filename);
var mimeCharset = mimeType === 'application/javascript' ?
'UTF-8' :
mime.charsets.lookup(mimeType, null);

res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
send(req, filename).pipe(res);
console.log('----- ' + pathname + ' ' + (new Date() - dt) + 'ms');
} catch (err) {
next(err);
}
}, function (err) {
builder(pathname).then(function (filename) {
try {
var mimeType = mime.lookup(filename);
Branch ConditionalExpression
✗ Positive was not returned (? ...)
'UTF-8' :
✗ Negative was not returned (: ...)
mime.charsets.lookup(mimeType, null);
var mimeCharset = mimeType === 'application/javascript' ?
'UTF-8' :
mime.charsets.lookup(mimeType, null);
Branch ConditionalExpression
✗ Positive was not returned (? ...)
res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
✗ Negative was not returned (: ...)
res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
res.setHeader('Content-Type', mimeType + (mimeCharset ? '; charset=' + mimeCharset : ''));
send(req, filename).pipe(res);
console.log('----- ' + pathname + ' ' + (new Date() - dt) + 'ms');
} catch (err) {
next(err);
}
Function (anonymous_606)
✗ Was not called
}, function (err) {···
if (err instanceof TargetNotFoundError) {
next();
} else {
next(err);
}
});
}, function (err) {
Branch IfStatement
✗ Positive was not executed (if)
if (err instanceof TargetNotFoundError) {···
next();
} else {
✗ Negative was not executed (else)
} else {···
next(err);
}
if (err instanceof TargetNotFoundError) {
next();
} else {
next(err);
}
});
};
};
/**
* @param {Object} options
* @param {String} options.cdir Корневая директория проекта.
* @param {Boolean} options.noLog Не логгировать в консоль процесс сборки.
* @returns {Function}
*/
Function (anonymous_607)
✗ Was not called
module.exports.createBuilder = function (options) {···
options = options || {};
options.cdir = options.cdir || process.cwd();
return function (path) {
var makePlatform = new MakePlatform();
var targetPath = path.replace(/^\/+|\/$/g, '');
return makePlatform.init(options.cdir).then(function () {
makePlatform.loadCache();
var logger = new Logger(targetPath + ' - ');
if (options.noLog) {
logger.setEnabled(false);
}
makePlatform.setLogger(logger);
return makePlatform.buildTargets([targetPath]).then(function () {
makePlatform.saveCache();
makePlatform.destruct();
return options.cdir + '/' + targetPath;
});
});
};
};
module.exports.createBuilder = function (options) {
Branch LogicalExpression
✗ Was not returned
options = options || {};
✗ Was not returned
options = options || {};
options = options || {};
Branch LogicalExpression
✗ Was not returned
options.cdir = options.cdir || process.cwd();
✗ Was not returned
options.cdir = options.cdir || process.cwd();
options.cdir = options.cdir || process.cwd();
Function (anonymous_608)
✗ Was not called
return function (path) {···
var makePlatform = new MakePlatform();
var targetPath = path.replace(/^\/+|\/$/g, '');
return makePlatform.init(options.cdir).then(function () {
makePlatform.loadCache();
var logger = new Logger(targetPath + ' - ');
if (options.noLog) {
logger.setEnabled(false);
}
makePlatform.setLogger(logger);
return makePlatform.buildTargets([targetPath]).then(function () {
makePlatform.saveCache();
makePlatform.destruct();
return options.cdir + '/' + targetPath;
});
});
};
return function (path) {
var makePlatform = new MakePlatform();
var targetPath = path.replace(/^\/+|\/$/g, '');
Function (anonymous_609)
✗ Was not called
return makePlatform.init(options.cdir).then(function () {···
makePlatform.loadCache();
var logger = new Logger(targetPath + ' - ');
if (options.noLog) {
logger.setEnabled(false);
}
makePlatform.setLogger(logger);
return makePlatform.buildTargets([targetPath]).then(function () {
makePlatform.saveCache();
makePlatform.destruct();
return options.cdir + '/' + targetPath;
});
});
return makePlatform.init(options.cdir).then(function () {
makePlatform.loadCache();
var logger = new Logger(targetPath + ' - ');
Branch IfStatement
✗ Positive was not executed (if)
if (options.noLog) {···
logger.setEnabled(false);
}
✗ Negative was not executed (else)
}···
makePlatform.setLogger(logger);
if (options.noLog) {
logger.setEnabled(false);
}
makePlatform.setLogger(logger);
Function (anonymous_610)
✗ Was not called
return makePlatform.buildTargets([targetPath]).then(function () {···
makePlatform.saveCache();
makePlatform.destruct();
return options.cdir + '/' + targetPath;
});
return makePlatform.buildTargets([targetPath]).then(function () {
makePlatform.saveCache();
makePlatform.destruct();
return options.cdir + '/' + targetPath;
});
});
};
};
help.js
/**
* CLI/help
* ========
*
* Этот файл отображает документацию.
*/
var path = require('path');
module.exports = function (program) {
program.command('help')
.description('displays help about techs')
Function (anonymous_612)
✗ Was not called
.action(function () {···
var args = program.args.slice(0);
args.pop();
var filename = args.shift();
if (!filename) {
console.log('Filename is not specified');
return;
}
filename = require.resolve(filename);
shell('sh', ['-c', 'node ' + path.resolve(__dirname, '../../node_modules/madify/bin/madify') +
' "' + filename + '" | ' +
path.resolve(__dirname, '../../node_modules/mad/bin/mad') + ' -'],
function () {
process.exit(0);
}
);
});
.action(function () {
var args = program.args.slice(0);
args.pop();
var filename = args.shift();
Branch IfStatement
✗ Positive was not executed (if)
if (!filename) {···
console.log('Filename is not specified');
return;
}
✗ Negative was not executed (else)
}···
filename = require.resolve(filename);
if (!filename) {
console.log('Filename is not specified');
return;
}
filename = require.resolve(filename);
shell('sh', ['-c', 'node ' + path.resolve(__dirname, '../../node_modules/madify/bin/madify') +
' "' + filename + '" | ' +
path.resolve(__dirname, '../../node_modules/mad/bin/mad') + ' -'],
Function (anonymous_613)
✗ Was not called
function () {···
process.exit(0);
}
function () {
process.exit(0);
}
);
});
};
var spawn = require('child_process').spawn;
Function shell
✗ Was not called
function shell(cmd, opts, callback) {···
var p;
process.stdin.pause();
process.stdin.setRawMode(false);
p = spawn(cmd, opts, {
customFds: [0, 1, 2]
});
return p.on('exit', function () {
process.stdin.setRawMode(true);
process.stdin.resume();
if (callback) {
callback();
}
});
}
function shell(cmd, opts, callback) {
var p;
process.stdin.pause();
process.stdin.setRawMode(false);
p = spawn(cmd, opts, {
customFds: [0, 1, 2]
});
Function (anonymous_615)
✗ Was not called
return p.on('exit', function () {···
process.stdin.setRawMode(true);
process.stdin.resume();
if (callback) {
callback();
}
});
return p.on('exit', function () {
process.stdin.setRawMode(true);
process.stdin.resume();
Branch IfStatement
✗ Positive was not executed (if)
if (callback) {···
callback();
}
✗ Negative was not executed (else)
}···
});
if (callback) {
callback();
}
});
}
module-config.js
/**
* ModuleConfig
* ==========
*/
var inherit = require('inherit');
var Vow = require('vow');
/**
* ModuleConfig — конфигуратор модуля.
* @name ModuleConfig
*/
module.exports = inherit(require('./configurable'), {
/**
* Конструктор.
*/
Function (anonymous_616)
✗ Was not called
__constructor: function () {···
this.__base();
},
__constructor: function () {
this.__base();
},
Function (anonymous_617)
✗ Was not called
getName: function () {···
throw new Error('You sould override "getName" method of module.');
},
getName: function () {
throw new Error('You sould override "getName" method of module.');
},
/**
* Выполняет цепочку коллбэков-конфигураторов.
* В случае, если конфигуратор возвращает промис, выполнение происходит асинхронно.
* @param {Object[]} args Аргументы, которые надо передавать в кажджый конфигуратор.
* @param {Object} ctxObject Контекст выполнения. Передается первым параметром в конфигураторы.
* @returns {Promise|undefined}
*/
Function (anonymous_618)
✗ Was not called
exec: function (args, ctxObject) {···
args = [ctxObject || this].concat(args || []);
var chains = this._chains;
function keepRunning() {
var chain = chains.shift();
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
return keepRunning();
}
exec: function (args, ctxObject) {
Branch LogicalExpression
✗ Was not returned
args = [ctxObject || this].concat(args || []);
✗ Was not returned
args = [ctxObject || this].concat(args || []);
Branch LogicalExpression
✗ Was not returned
args = [ctxObject || this].concat(args || []);
✗ Was not returned
args = [ctxObject || this].concat(args || []);
args = [ctxObject || this].concat(args || []);
var chains = this._chains;
Function keepRunning
✗ Was not called
function keepRunning() {···
var chain = chains.shift();
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
function keepRunning() {
var chain = chains.shift();
Function (anonymous_620)
✗ Was not called
return chain && Vow.when(chain.apply(this, args)).then(function () {···
return keepRunning();
});
Branch LogicalExpression
✗ Was not returned
return chain && Vow.when(chain.apply(this, args)).then(function () {···
return keepRunning();
});
✗ Was not returned
return chain && Vow.when(chain.apply(this, args)).then(function () {
return chain && Vow.when(chain.apply(this, args)).then(function () {
return keepRunning();
});
}
return keepRunning();
}
});
level-plain.js
/**
* level-plain
* ===========
*
* Схема именования для уровней переопределения.
*/
var FileList = require('../file-list');
var Vow = require('vow');
var fs = require('fs');
module.exports = {
Function (anonymous_621)
✗ Was not called
buildLevel: function (levelPath, levelBuilder) {···
return Vow.when(addPlainFiles(levelPath, levelBuilder)).then(function () {
levelBuilder.build();
});
},
buildLevel: function (levelPath, levelBuilder) {
Function (anonymous_622)
✗ Was not called
return Vow.when(addPlainFiles(levelPath, levelBuilder)).then(function () {···
levelBuilder.build();
});
return Vow.when(addPlainFiles(levelPath, levelBuilder)).then(function () {
levelBuilder.build();
});
},
Function (anonymous_623)
✗ Was not called
buildFilePath: function (levelPath, blockName, elemName, modName, modVal) {···
return levelPath + '/' + blockName +
(elemName ? '__' + elemName : '') +
(modName ? '_' + modName : '') +
(modVal ? '_' + modVal : '');
}
buildFilePath: function (levelPath, blockName, elemName, modName, modVal) {
return levelPath + '/' + blockName +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(elemName ? '__' + elemName : '') +
✗ Negative was not returned (: ...)
(elemName ? '__' + elemName : '') +
(elemName ? '__' + elemName : '') +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(modName ? '_' + modName : '') +
✗ Negative was not returned (: ...)
(modName ? '_' + modName : '') +
(modName ? '_' + modName : '') +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
(modVal ? '_' + modVal : '');
✗ Negative was not returned (: ...)
(modVal ? '_' + modVal : '');
(modVal ? '_' + modVal : '');
}
};
Function addPlainFiles
✗ Was not called
function addPlainFiles(directory, levelBuilder) {···
filterFiles(fs.readdirSync(directory)).forEach(function (filename) {
var fullname = directory + '/' + filename;
var stat = fs.statSync(fullname);
var bem;
if (stat.isDirectory()) {
if (filename.indexOf('.') !== -1) {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
} else {
addPlainFiles(fullname, levelBuilder);
}
} else {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
}
});
}
function addPlainFiles(directory, levelBuilder) {
Function (anonymous_625)
✗ Was not called
filterFiles(fs.readdirSync(directory)).forEach(function (filename) {···
var fullname = directory + '/' + filename;
var stat = fs.statSync(fullname);
var bem;
if (stat.isDirectory()) {
if (filename.indexOf('.') !== -1) {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
} else {
addPlainFiles(fullname, levelBuilder);
}
} else {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
}
});
filterFiles(fs.readdirSync(directory)).forEach(function (filename) {
var fullname = directory + '/' + filename;
var stat = fs.statSync(fullname);
var bem;
Branch IfStatement
✗ Positive was not executed (if)
if (stat.isDirectory()) {···
if (filename.indexOf('.') !== -1) {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
} else {
addPlainFiles(fullname, levelBuilder);
}
} else {
✗ Negative was not executed (else)
} else {···
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
}
if (stat.isDirectory()) {
Branch IfStatement
✗ Positive was not executed (if)
if (filename.indexOf('.') !== -1) {···
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
} else {
✗ Negative was not executed (else)
} else {···
addPlainFiles(fullname, levelBuilder);
}
if (filename.indexOf('.') !== -1) {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
} else {
addPlainFiles(fullname, levelBuilder);
}
} else {
bem = FileList.parseFilename(filename).bem;
levelBuilder.addFile(fullname, bem.block, bem.elem, bem.modName, bem.modVal);
}
});
}
Function filterFiles
✗ Was not called
function filterFiles(filenames) {···
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
function filterFiles(filenames) {
Function (anonymous_627)
✗ Was not called
return filenames.filter(function (filename) {···
return filename.charAt(0) !== '.';
});
return filenames.filter(function (filename) {
return filename.charAt(0) !== '.';
});
}
file-assemble-tech.js
/**
* FileAssembleTech
* ================
*/
var inherit = require('inherit');
var Vow = require('vow');
var vowFs = require('../fs/async-fs');
/**
* Одна из вариаций хэлпера для упрощения создания технологий.
* Был заменен на BuildFlow.
* Более не поддерживается.
* @name FileAssembleTech
*
* @deprecated
*/
var FileAssembleTech = inherit(require('./base-tech'), /** @lends FileAssembleTech.prototype */ {
Function (anonymous_628)
✗ Was not called
init: function () {···
this.__base.apply(this, arguments);
this._filesTarget = this.node.unmaskTargetName(this.getOption('filesTarget', '?.files'));
},
init: function () {
this.__base.apply(this, arguments);
this._filesTarget = this.node.unmaskTargetName(this.getOption('filesTarget', '?.files'));
},
Function (anonymous_629)
✗ Was not called
getDestSuffixes: function () {···
throw new Error('You are required to override getDestSuffixes method of FileAssembleTech.');
},
getDestSuffixes: function () {
throw new Error('You are required to override getDestSuffixes method of FileAssembleTech.');
},
Function (anonymous_630)
✗ Was not called
getSourceSuffixes: function () {···
throw new Error('You are required to override getSourceSuffixes method of FileAssembleTech.');
},
getSourceSuffixes: function () {
throw new Error('You are required to override getSourceSuffixes method of FileAssembleTech.');
},
Function (anonymous_631)
✗ Was not called
getTargetName: function (suffix) {···
return this.node.getTargetName(suffix);
},
getTargetName: function (suffix) {
return this.node.getTargetName(suffix);
},
Function (anonymous_632)
✗ Was not called
getTargets: function () {···
var _this = this;
return this.getDestSuffixes().map(function (suffix) {
return _this.getTargetName(suffix);
});
},
getTargets: function () {
var _this = this;
Function (anonymous_633)
✗ Was not called
return this.getDestSuffixes().map(function (suffix) {···
return _this.getTargetName(suffix);
});
return this.getDestSuffixes().map(function (suffix) {
return _this.getTargetName(suffix);
});
},
Function (anonymous_634)
✗ Was not called
isRebuildRequired: function (suffix) {···
var target = this.getTargetName(suffix);
return this.node.getNodeCache(target).needRebuildFile('file', this.node.resolvePath(target));
},
isRebuildRequired: function (suffix) {
var target = this.getTargetName(suffix);
return this.node.getNodeCache(target).needRebuildFile('file', this.node.resolvePath(target));
},
Function (anonymous_635)
✗ Was not called
cacheSuffixInfo: function (suffix) {···
var target = this.getTargetName(suffix);
this.node.getNodeCache(target).cacheFileInfo('file', this.node.resolvePath(target));
},
cacheSuffixInfo: function (suffix) {
var target = this.getTargetName(suffix);
this.node.getNodeCache(target).cacheFileInfo('file', this.node.resolvePath(target));
},
Function (anonymous_636)
✗ Was not called
buildResultCached: function (sourceFiles, suffix) {···
var target = this.getTargetName(suffix);
var cache = this.node.getNodeCache(target);
var _this = this;
if (this.isRebuildRequired(suffix) || cache.needRebuildFileList('file-list', sourceFiles)) {
return Vow.when(this.buildResult(sourceFiles, suffix))
.then(function () {
_this.cacheSuffixInfo(suffix);
cache.cacheFileList('file-list', sourceFiles);
_this.node.resolveTarget(target);
});
} else {
_this.node.isValidTarget(target);
_this.node.resolveTarget(target);
return Vow.fulfill();
}
},
buildResultCached: function (sourceFiles, suffix) {
var target = this.getTargetName(suffix);
var cache = this.node.getNodeCache(target);
var _this = this;
Branch IfStatement
✗ Positive was not executed (if)
if (this.isRebuildRequired(suffix) || cache.needRebuildFileList('file-list', sourceFiles)) {···
return Vow.when(this.buildResult(sourceFiles, suffix))
.then(function () {
_this.cacheSuffixInfo(suffix);
cache.cacheFileList('file-list', sourceFiles);
_this.node.resolveTarget(target);
});
} else {
✗ Negative was not executed (else)
} else {···
_this.node.isValidTarget(target);
_this.node.resolveTarget(target);
return Vow.fulfill();
}
Branch LogicalExpression
✗ Was not returned
if (this.isRebuildRequired(suffix) || cache.needRebuildFileList('file-list', sourceFiles)) {
✗ Was not returned
if (this.isRebuildRequired(suffix) || cache.needRebuildFileList('file-list', sourceFiles)) {
if (this.isRebuildRequired(suffix) || cache.needRebuildFileList('file-list', sourceFiles)) {
return Vow.when(this.buildResult(sourceFiles, suffix))
Function (anonymous_637)
✗ Was not called
.then(function () {···
_this.cacheSuffixInfo(suffix);
cache.cacheFileList('file-list', sourceFiles);
_this.node.resolveTarget(target);
});
.then(function () {
_this.cacheSuffixInfo(suffix);
cache.cacheFileList('file-list', sourceFiles);
_this.node.resolveTarget(target);
});
} else {
_this.node.isValidTarget(target);
_this.node.resolveTarget(target);
return Vow.fulfill();
}
},
Function (anonymous_638)
✗ Was not called
buildResult: function (sourceFiles, suffix) {···
var _this = this;
try {
return Vow.when(this.getBuildResult(sourceFiles, suffix))
.then(function (content) {
return vowFs.write(_this.node.resolvePath(_this.getTargetName(suffix)), content, 'utf8');
});
} catch (err) {
return Vow.reject(err);
}
},
buildResult: function (sourceFiles, suffix) {
var _this = this;
try {
return Vow.when(this.getBuildResult(sourceFiles, suffix))
Function (anonymous_639)
✗ Was not called
.then(function (content) {···
return vowFs.write(_this.node.resolvePath(_this.getTargetName(suffix)), content, 'utf8');
});
.then(function (content) {
return vowFs.write(_this.node.resolvePath(_this.getTargetName(suffix)), content, 'utf8');
});
} catch (err) {
return Vow.reject(err);
}
},
Function (anonymous_640)
✗ Was not called
getBuildResult: function () {···
throw new Error('You are required to override getBuildResult method of FileAssembleTech.');
},
getBuildResult: function () {
throw new Error('You are required to override getBuildResult method of FileAssembleTech.');
},
Function (anonymous_641)
✗ Was not called
buildResults: function (sourceFiles, suffixes) {···
var _this = this;
return Vow.all(suffixes.map(function (suffix) {
return _this.buildResultCached(sourceFiles, suffix);
}));
},
buildResults: function (sourceFiles, suffixes) {
var _this = this;
Function (anonymous_642)
✗ Was not called
return Vow.all(suffixes.map(function (suffix) {···
return _this.buildResultCached(sourceFiles, suffix);
}));
return Vow.all(suffixes.map(function (suffix) {
return _this.buildResultCached(sourceFiles, suffix);
}));
},
Function (anonymous_643)
✗ Was not called
writeFile: function (filename, content) {···
return vowFs.write(filename, content, 'utf8');
},
writeFile: function (filename, content) {
return vowFs.write(filename, content, 'utf8');
},
Function (anonymous_644)
✗ Was not called
filterSourceFiles: function (files) {···
return files;
},
filterSourceFiles: function (files) {
return files;
},
Function (anonymous_645)
✗ Was not called
build: function () {···
var _this = this;
return this.node.requireSources([this._filesTarget]).spread(function (files) {
var sourceSuffixes = _this.getSourceSuffixes() || [];
var sourceFiles = sourceSuffixes.length ? files.getBySuffix(sourceSuffixes) : [];
sourceFiles = _this.filterSourceFiles(sourceFiles);
return Vow.when(_this.getDestSuffixes()).then(function (suffixes) {
return _this.buildResults(sourceFiles, suffixes);
});
});
}
build: function () {
var _this = this;
Function (anonymous_646)
✗ Was not called
return this.node.requireSources([this._filesTarget]).spread(function (files) {···
var sourceSuffixes = _this.getSourceSuffixes() || [];
var sourceFiles = sourceSuffixes.length ? files.getBySuffix(sourceSuffixes) : [];
sourceFiles = _this.filterSourceFiles(sourceFiles);
return Vow.when(_this.getDestSuffixes()).then(function (suffixes) {
return _this.buildResults(sourceFiles, suffixes);
});
});
return this.node.requireSources([this._filesTarget]).spread(function (files) {
Branch LogicalExpression
✗ Was not returned
var sourceSuffixes = _this.getSourceSuffixes() || [];
✗ Was not returned
var sourceSuffixes = _this.getSourceSuffixes() || [];
var sourceSuffixes = _this.getSourceSuffixes() || [];
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var sourceFiles = sourceSuffixes.length ? files.getBySuffix(sourceSuffixes) : [];
✗ Negative was not returned (: ...)
var sourceFiles = sourceSuffixes.length ? files.getBySuffix(sourceSuffixes) : [];
var sourceFiles = sourceSuffixes.length ? files.getBySuffix(sourceSuffixes) : [];
sourceFiles = _this.filterSourceFiles(sourceFiles);
Function (anonymous_647)
✗ Was not called
return Vow.when(_this.getDestSuffixes()).then(function (suffixes) {···
return _this.buildResults(sourceFiles, suffixes);
});
return Vow.when(_this.getDestSuffixes()).then(function (suffixes) {
return _this.buildResults(sourceFiles, suffixes);
});
});
}
});
module.exports = FileAssembleTech;
test-file-system.js
var fs = require('fs');
var inherit = require('inherit');
var vow = require('vow');
var path = require('path');
var asyncFs = require('../../fs/async-fs');
/**
* @name TestFileSystem
*/
module.exports = inherit({
Function (anonymous_648)
✗ Was not called
__constructor: function (fileSystemStructure, root) {···
this._structure = fileSystemStructure;
this._root = root || process.cwd();
this._originalFsFunctions = null;
this._originalAsyncFsFunctions = null;
},
__constructor: function (fileSystemStructure, root) {
this._structure = fileSystemStructure;
Branch LogicalExpression
✗ Was not returned
this._root = root || process.cwd();
✗ Was not returned
this._root = root || process.cwd();
this._root = root || process.cwd();
this._originalFsFunctions = null;
this._originalAsyncFsFunctions = null;
},
Function (anonymous_649)
✗ Was not called
setup: function () {···
var mocks = createMocks(this._structure, this._root);

this._originalAsyncFsFunctions = {};
for (var asyncFsMethodName in asyncFs) {
this._originalAsyncFsFunctions[asyncFsMethodName] = asyncFs[asyncFsMethodName];
// Заменяем пустой функцией для безопасности.
asyncFs[asyncFsMethodName] = createEmptyFunction(asyncFsMethodName);
}
for (var asyncFsMockName in mocks.vowFs) {
asyncFs[asyncFsMockName] = mocks.vowFs[asyncFsMockName];
}

this._originalFsFunctions = {};
for (var fsMethodName in fs) {
this._originalFsFunctions[fsMethodName] = fs[fsMethodName];
// Заменяем пустой функцией для безопасности.
fs[fsMethodName] = createEmptyFunction(fsMethodName);
}
for (var fsMockName in mocks.fs) {
fs[fsMockName] = mocks.fs[fsMockName];
}
},
setup: function () {
var mocks = createMocks(this._structure, this._root);
this._originalAsyncFsFunctions = {};
for (var asyncFsMethodName in asyncFs) {
this._originalAsyncFsFunctions[asyncFsMethodName] = asyncFs[asyncFsMethodName];
// Заменяем пустой функцией для безопасности.
asyncFs[asyncFsMethodName] = createEmptyFunction(asyncFsMethodName);
}
for (var asyncFsMockName in mocks.vowFs) {
asyncFs[asyncFsMockName] = mocks.vowFs[asyncFsMockName];
}
this._originalFsFunctions = {};
for (var fsMethodName in fs) {
this._originalFsFunctions[fsMethodName] = fs[fsMethodName];
// Заменяем пустой функцией для безопасности.
fs[fsMethodName] = createEmptyFunction(fsMethodName);
}
for (var fsMockName in mocks.fs) {
fs[fsMockName] = mocks.fs[fsMockName];
}
},
Function (anonymous_650)
✗ Was not called
teardown: function () {···
for (var asyncFsMethodName in this._originalAsyncFsFunctions) {
asyncFs[asyncFsMethodName] = this._originalAsyncFsFunctions[asyncFsMethodName];
}
for (var fsMethodName in this._originalFsFunctions) {
fs[fsMethodName] = this._originalFsFunctions[fsMethodName];
}
}
teardown: function () {
for (var asyncFsMethodName in this._originalAsyncFsFunctions) {
asyncFs[asyncFsMethodName] = this._originalAsyncFsFunctions[asyncFsMethodName];
}
for (var fsMethodName in this._originalFsFunctions) {
fs[fsMethodName] = this._originalFsFunctions[fsMethodName];
}
}
});
Function createEmptyFunction
✗ Was not called
function createEmptyFunction(methodName) {···
return function () {
throw new Error('Mock `' + methodName + '` is not implemented.');
};
}
function createEmptyFunction(methodName) {
Function (anonymous_652)
✗ Was not called
return function () {···
throw new Error('Mock `' + methodName + '` is not implemented.');
};
return function () {
throw new Error('Mock `' + methodName + '` is not implemented.');
};
}
Function createMocks
✗ Was not called
function createMocks (structure, root) {···
var timeObj = new Date();
function isAbsolutePath(filePath) {
return filePath.charAt(0) === '/';
}
function getRelativePath(filePath) {
if (isAbsolutePath(filePath)) {
if (filePath.indexOf(root + '/') === 0) {
return filePath.replace(root + '/', '');
} else {
return null;
}
} else {
return filePath;
}
}
function getNodeName(node) {
if (node.directory) {
return node.directory;
} else {
return node.file;
}
}
function getNode(filePath) {
filePath = getRelativePath(filePath);
var pathBits = filePath.split('/');
var nodeItems = structure;
var currentPathBit;
var foundNode;
while (Boolean(currentPathBit = pathBits.shift())) {
if (!nodeItems) {
return null;
}
foundNode = null;
for (var i = 0; i < nodeItems.length; i++) {
var subNode = nodeItems[i];
if (getNodeName(subNode) === currentPathBit) {
foundNode = subNode;
}
}
if (!foundNode) {
return null;
}
nodeItems = foundNode.items;
}
return foundNode;
}
function isFile(node) {
return !!node.file;
}
function isDirectory(node) {
return !!node.directory;
}
function isSocket() {
return false;
}
function isSymLink() {
return false;
}
function createFileNotFoundError(filename) {
return new Error('File not found: ' + filename + ' (' + getRelativePath(filename) + ')');
}
function createIsDirectoryError(filename) {
return new Error('Path is a directory: ' + filename);
}
function createIsFileError(filename) {
return new Error('Path is a file: ' + filename);
}
function createFileNode(name, content) {
return {file: name, content: content};
}
function createDirectoryNode(name) {
return {directory: name, items: []};
}
function createStats(node) {
return {
uid: 0,
gid: 0,
isFile: function () {
return isFile(node);
},
isDirectory: function () {
return isDirectory(node);
},
isSymbolicLink: function () {
return isSymLink(node);
},
isSocket: function () {
return isSocket(node);
},
size: node.content ? node.content.length : 0,
atime: timeObj,
mtime: timeObj,
ctime: timeObj
};
}
return {
vowFs: {
read: function (filename) {
try {
return vow.fulfill(this._readSync(filename));
} catch (e) {
return vow.reject(e);
}
},

_readSync: function (filename) {
var node = getNode(filename);
if (node) {
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
},

write: function (filename, content) {
var node = getNode(filename);
if (node) {
if (isFile(node)) {
node.content = content;
return vow.resolve();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
var parentNode = getNode(path.dirname(filename));
if (parentNode) {
if (isDirectory(parentNode)) {
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
return vow.reject(createIsFileError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
}
},

append: function (filename, data) {
return this.read(filename, function (content) {
return this.write(filename, content + data);
}.bind(this));
},

remove: function (filename) {
var node = getNode(filename);
if (node) {
if (isFile(node)) {
var parentNode = getNode(path.basename(filename));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

removeDir: function (dirPath) {
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
var parentNode = getNode(path.basename(dirPath));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},

move: function (source, dest) {
return this.copy(source, dest).then(function () {
return this.isFile(source).then(function (isFile) {
return isFile ? this.remove(source) : this.removeDir(source);
}.bind(this));
}.bind(this));
},

copy: function (source, dest) {
var node = getNode(source);
var destNode = getNode(dest);
if (destNode) {
var destParentNode = getNode(path.basename(dest));
destParentNode.items.splice(destParentNode.items.indexOf(destNode), 1);
}
if (node) {
if (isFile(node)) {
return this.read(source).then(function (data) {
return this.write(dest, data);
}.bind(this));
} else {
return this.makeDir(dest).then(function () {
return this.listDir(source).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
}
} else {
throw createFileNotFoundError(source);
}
},

listDir: function (dirPath) {
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
return vow.fulfill(node.items.map(function (subNode) {
return getNodeName(subNode);
}));
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},

makeDir: function (dirPath) {
var node = getNode(dirPath);
if (node) {
if (isFile(node)) {
return vow.reject(createIsFileError(dirPath));
} else {
return vow.fulfill();
}
} else {
var parentDirPath = path.basename(dirPath);
return this.makeDir(parentDirPath).then(function () {
var parentNode = getNode(parentDirPath);
var childNode = getNode(dirPath);
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
});
}
},

isFile: function (filename) {
var node = getNode(filename);
if (node) {
return vow.fulfill(isFile(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

isDir: function (filename) {
var node = getNode(filename);
if (node) {
return vow.fulfill(isDirectory(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

isSocket: function (filename) {
var node = getNode(filename);
if (node) {
return vow.fulfill(isSocket(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

isSymLink: function (filename) {
var node = getNode(filename);
if (node) {
return vow.fulfill(isSymLink(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

exists: function (filename) {
return vow.fulfill(Boolean(getNode(filename)));
},

absolute: function (filename) {
return vow.fulfill(path.resolve(root, filename));
},

chown: function () {
return vow.fulfill(); // не поддерживаем права
},

chmod: function () {
return vow.fulfill(); // не поддерживаем права
},

stats: function (filename) {
var node = getNode(filename);
if (node) {
return vow.fulfill(createStats(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},

link: function () {
return vow.fulfill(); // не поддерживаем ссылки
},

symLink: function () {
return vow.fulfill(); // не поддерживаем ссылки
}
},
fs: {
existsSync: function (filename) {
return Boolean(getNode(filename));
},

statSync: function (filename) {
var node = getNode(filename);
if (node) {
return createStats(node);
} else {
throw createFileNotFoundError(filename);
}
},

readdir: function (dirPath, callback) {
var node = getNode(dirPath);
if (!node) {
return callback(createFileNotFoundError(dirPath));
}
if (!isDirectory(node)) {
return callback(createIsFileError(dirPath));
}
callback(undefined, node.items.map(function (subNode) {
return getNodeName(subNode);
}));
},

readdirSync: function (dirPath) {
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
return node.items.map(function (subNode) {
return getNodeName(subNode);
});
} else {
throw createIsFileError(dirPath);
}
} else {
throw createFileNotFoundError(dirPath);
}
},

realpathSync: function (destPath) {
return path.resolve(process.cwd(), destPath);
},

readFileSync: function (filename) {
var node = getNode(filename);
if (node) {
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
}
}
};
}
function createMocks (structure, root) {
var timeObj = new Date();
Function isAbsolutePath
✗ Was not called
function isAbsolutePath(filePath) {···
return filePath.charAt(0) === '/';
}
function isAbsolutePath(filePath) {
return filePath.charAt(0) === '/';
}
Function getRelativePath
✗ Was not called
function getRelativePath(filePath) {···
if (isAbsolutePath(filePath)) {
if (filePath.indexOf(root + '/') === 0) {
return filePath.replace(root + '/', '');
} else {
return null;
}
} else {
return filePath;
}
}
function getRelativePath(filePath) {
Branch IfStatement
✗ Positive was not executed (if)
if (isAbsolutePath(filePath)) {···
if (filePath.indexOf(root + '/') === 0) {
return filePath.replace(root + '/', '');
} else {
return null;
}
} else {
✗ Negative was not executed (else)
} else {···
return filePath;
}
if (isAbsolutePath(filePath)) {
Branch IfStatement
✗ Positive was not executed (if)
if (filePath.indexOf(root + '/') === 0) {···
return filePath.replace(root + '/', '');
} else {
✗ Negative was not executed (else)
} else {···
return null;
}
if (filePath.indexOf(root + '/') === 0) {
return filePath.replace(root + '/', '');
} else {
return null;
}
} else {
return filePath;
}
}
Function getNodeName
✗ Was not called
function getNodeName(node) {···
if (node.directory) {
return node.directory;
} else {
return node.file;
}
}
function getNodeName(node) {
Branch IfStatement
✗ Positive was not executed (if)
if (node.directory) {···
return node.directory;
} else {
✗ Negative was not executed (else)
} else {···
return node.file;
}
if (node.directory) {
return node.directory;
} else {
return node.file;
}
}
Function getNode
✗ Was not called
function getNode(filePath) {···
filePath = getRelativePath(filePath);
var pathBits = filePath.split('/');
var nodeItems = structure;
var currentPathBit;
var foundNode;
while (Boolean(currentPathBit = pathBits.shift())) {
if (!nodeItems) {
return null;
}
foundNode = null;
for (var i = 0; i < nodeItems.length; i++) {
var subNode = nodeItems[i];
if (getNodeName(subNode) === currentPathBit) {
foundNode = subNode;
}
}
if (!foundNode) {
return null;
}
nodeItems = foundNode.items;
}
return foundNode;
}
function getNode(filePath) {
filePath = getRelativePath(filePath);
var pathBits = filePath.split('/');
var nodeItems = structure;
var currentPathBit;
var foundNode;
while (Boolean(currentPathBit = pathBits.shift())) {
Branch IfStatement
✗ Positive was not executed (if)
if (!nodeItems) {···
return null;
}
✗ Negative was not executed (else)
}···
foundNode = null;
if (!nodeItems) {
return null;
}
foundNode = null;
for (var i = 0; i < nodeItems.length; i++) {
var subNode = nodeItems[i];
Branch IfStatement
✗ Positive was not executed (if)
if (getNodeName(subNode) === currentPathBit) {···
foundNode = subNode;
}
✗ Negative was not executed (else)
}···
}
if (getNodeName(subNode) === currentPathBit) {
foundNode = subNode;
}
}
Branch IfStatement
✗ Positive was not executed (if)
if (!foundNode) {···
return null;
}
✗ Negative was not executed (else)
}···
nodeItems = foundNode.items;
if (!foundNode) {
return null;
}
nodeItems = foundNode.items;
}
return foundNode;
}
Function isFile
✗ Was not called
function isFile(node) {···
return !!node.file;
}
function isFile(node) {
return !!node.file;
}
Function isDirectory
✗ Was not called
function isDirectory(node) {···
return !!node.directory;
}
function isDirectory(node) {
return !!node.directory;
}
Function isSocket
✗ Was not called
function isSocket() {···
return false;
}
function isSocket() {
return false;
}
Function isSymLink
✗ Was not called
function isSymLink() {···
return false;
}
function isSymLink() {
return false;
}
Function createFileNotFoundError
✗ Was not called
function createFileNotFoundError(filename) {···
return new Error('File not found: ' + filename + ' (' + getRelativePath(filename) + ')');
}
function createFileNotFoundError(filename) {
return new Error('File not found: ' + filename + ' (' + getRelativePath(filename) + ')');
}
Function createIsDirectoryError
✗ Was not called
function createIsDirectoryError(filename) {···
return new Error('Path is a directory: ' + filename);
}
function createIsDirectoryError(filename) {
return new Error('Path is a directory: ' + filename);
}
Function createIsFileError
✗ Was not called
function createIsFileError(filename) {···
return new Error('Path is a file: ' + filename);
}
function createIsFileError(filename) {
return new Error('Path is a file: ' + filename);
}
Function createFileNode
✗ Was not called
function createFileNode(name, content) {···
return {file: name, content: content};
}
function createFileNode(name, content) {
return {file: name, content: content};
}
Function createDirectoryNode
✗ Was not called
function createDirectoryNode(name) {···
return {directory: name, items: []};
}
function createDirectoryNode(name) {
return {directory: name, items: []};
}
Function createStats
✗ Was not called
function createStats(node) {···
return {
uid: 0,
gid: 0,
isFile: function () {
return isFile(node);
},
isDirectory: function () {
return isDirectory(node);
},
isSymbolicLink: function () {
return isSymLink(node);
},
isSocket: function () {
return isSocket(node);
},
size: node.content ? node.content.length : 0,
atime: timeObj,
mtime: timeObj,
ctime: timeObj
};
}
function createStats(node) {
return {
uid: 0,
gid: 0,
Function (anonymous_668)
✗ Was not called
isFile: function () {···
return isFile(node);
},
isFile: function () {
return isFile(node);
},
Function (anonymous_669)
✗ Was not called
isDirectory: function () {···
return isDirectory(node);
},
isDirectory: function () {
return isDirectory(node);
},
Function (anonymous_670)
✗ Was not called
isSymbolicLink: function () {···
return isSymLink(node);
},
isSymbolicLink: function () {
return isSymLink(node);
},
Function (anonymous_671)
✗ Was not called
isSocket: function () {···
return isSocket(node);
},
isSocket: function () {
return isSocket(node);
},
Branch ConditionalExpression
✗ Positive was not returned (? ...)
size: node.content ? node.content.length : 0,
✗ Negative was not returned (: ...)
size: node.content ? node.content.length : 0,
size: node.content ? node.content.length : 0,
atime: timeObj,
mtime: timeObj,
ctime: timeObj
};
}
return {
vowFs: {
Function (anonymous_672)
✗ Was not called
read: function (filename) {···
try {
return vow.fulfill(this._readSync(filename));
} catch (e) {
return vow.reject(e);
}
},
read: function (filename) {
try {
return vow.fulfill(this._readSync(filename));
} catch (e) {
return vow.reject(e);
}
},
Function (anonymous_673)
✗ Was not called
_readSync: function (filename) {···
var node = getNode(filename);
if (node) {
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
},
_readSync: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
✗ Negative was not executed (else)
} else {···
throw createFileNotFoundError(filename);
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
return node.content;
} else {
✗ Negative was not executed (else)
} else {···
throw createIsDirectoryError(filename);
}
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
},
Function (anonymous_674)
✗ Was not called
write: function (filename, content) {···
var node = getNode(filename);
if (node) {
if (isFile(node)) {
node.content = content;
return vow.resolve();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
var parentNode = getNode(path.dirname(filename));
if (parentNode) {
if (isDirectory(parentNode)) {
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
return vow.reject(createIsFileError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
}
},
write: function (filename, content) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
node.content = content;
return vow.resolve();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
✗ Negative was not executed (else)
} else {···
var parentNode = getNode(path.dirname(filename));
if (parentNode) {
if (isDirectory(parentNode)) {
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
return vow.reject(createIsFileError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
node.content = content;
return vow.resolve();
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsDirectoryError(filename));
}
if (isFile(node)) {
node.content = content;
return vow.resolve();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
var parentNode = getNode(path.dirname(filename));
Branch IfStatement
✗ Positive was not executed (if)
if (parentNode) {···
if (isDirectory(parentNode)) {
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
return vow.reject(createIsFileError(filename));
}
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (parentNode) {
Branch IfStatement
✗ Positive was not executed (if)
if (isDirectory(parentNode)) {···
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsFileError(filename));
}
if (isDirectory(parentNode)) {
parentNode.items.push(createFileNode(path.basename(filename), content));
return vow.resolve();
} else {
return vow.reject(createIsFileError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
}
},
Function (anonymous_675)
✗ Was not called
append: function (filename, data) {···
return this.read(filename, function (content) {
return this.write(filename, content + data);
}.bind(this));
},
append: function (filename, data) {
Function (anonymous_676)
✗ Was not called
return this.read(filename, function (content) {···
return this.write(filename, content + data);
}.bind(this));
return this.read(filename, function (content) {
return this.write(filename, content + data);
}.bind(this));
},
Function (anonymous_677)
✗ Was not called
remove: function (filename) {···
var node = getNode(filename);
if (node) {
if (isFile(node)) {
var parentNode = getNode(path.basename(filename));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
remove: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
var parentNode = getNode(path.basename(filename));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
var parentNode = getNode(path.basename(filename));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsDirectoryError(filename));
}
if (isFile(node)) {
var parentNode = getNode(path.basename(filename));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsDirectoryError(filename));
}
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_678)
✗ Was not called
removeDir: function (dirPath) {···
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
var parentNode = getNode(path.basename(dirPath));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},
removeDir: function (dirPath) {
var node = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isDirectory(node)) {
var parentNode = getNode(path.basename(dirPath));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(dirPath));
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isDirectory(node)) {···
var parentNode = getNode(path.basename(dirPath));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsFileError(dirPath));
}
if (isDirectory(node)) {
var parentNode = getNode(path.basename(dirPath));
parentNode.items.splice(parentNode.items.indexOf(node), 1);
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},
Function (anonymous_679)
✗ Was not called
move: function (source, dest) {···
return this.copy(source, dest).then(function () {
return this.isFile(source).then(function (isFile) {
return isFile ? this.remove(source) : this.removeDir(source);
}.bind(this));
}.bind(this));
},
move: function (source, dest) {
Function (anonymous_680)
✗ Was not called
return this.copy(source, dest).then(function () {···
return this.isFile(source).then(function (isFile) {
return isFile ? this.remove(source) : this.removeDir(source);
}.bind(this));
}.bind(this));
return this.copy(source, dest).then(function () {
Function (anonymous_681)
✗ Was not called
return this.isFile(source).then(function (isFile) {···
return isFile ? this.remove(source) : this.removeDir(source);
}.bind(this));
return this.isFile(source).then(function (isFile) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return isFile ? this.remove(source) : this.removeDir(source);
✗ Negative was not returned (: ...)
return isFile ? this.remove(source) : this.removeDir(source);
return isFile ? this.remove(source) : this.removeDir(source);
}.bind(this));
}.bind(this));
},
Function (anonymous_682)
✗ Was not called
copy: function (source, dest) {···
var node = getNode(source);
var destNode = getNode(dest);
if (destNode) {
var destParentNode = getNode(path.basename(dest));
destParentNode.items.splice(destParentNode.items.indexOf(destNode), 1);
}
if (node) {
if (isFile(node)) {
return this.read(source).then(function (data) {
return this.write(dest, data);
}.bind(this));
} else {
return this.makeDir(dest).then(function () {
return this.listDir(source).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
}
} else {
throw createFileNotFoundError(source);
}
},
copy: function (source, dest) {
var node = getNode(source);
var destNode = getNode(dest);
Branch IfStatement
✗ Positive was not executed (if)
if (destNode) {···
var destParentNode = getNode(path.basename(dest));
destParentNode.items.splice(destParentNode.items.indexOf(destNode), 1);
}
✗ Negative was not executed (else)
}···
if (node) {
if (destNode) {
var destParentNode = getNode(path.basename(dest));
destParentNode.items.splice(destParentNode.items.indexOf(destNode), 1);
}
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
return this.read(source).then(function (data) {
return this.write(dest, data);
}.bind(this));
} else {
return this.makeDir(dest).then(function () {
return this.listDir(source).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
}
} else {
✗ Negative was not executed (else)
} else {···
throw createFileNotFoundError(source);
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
return this.read(source).then(function (data) {
return this.write(dest, data);
}.bind(this));
} else {
✗ Negative was not executed (else)
} else {···
return this.makeDir(dest).then(function () {
return this.listDir(source).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
}
if (isFile(node)) {
Function (anonymous_683)
✗ Was not called
return this.read(source).then(function (data) {···
return this.write(dest, data);
}.bind(this));
return this.read(source).then(function (data) {
return this.write(dest, data);
}.bind(this));
} else {
Function (anonymous_684)
✗ Was not called
return this.makeDir(dest).then(function () {···
return this.listDir(source).then(function (filenames) {
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
return this.makeDir(dest).then(function () {
Function (anonymous_685)
✗ Was not called
return this.listDir(source).then(function (filenames) {···
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
return this.listDir(source).then(function (filenames) {
Function (anonymous_686)
✗ Was not called
return vow.all(filenames.map(function (filename) {···
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
return vow.all(filenames.map(function (filename) {
return this.copy(source + '/' + filename, dest + '/' + filename);
}, this));
}.bind(this));
}.bind(this));
}
} else {
throw createFileNotFoundError(source);
}
},
Function (anonymous_687)
✗ Was not called
listDir: function (dirPath) {···
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
return vow.fulfill(node.items.map(function (subNode) {
return getNodeName(subNode);
}));
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},
listDir: function (dirPath) {
var node = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isDirectory(node)) {
return vow.fulfill(node.items.map(function (subNode) {
return getNodeName(subNode);
}));
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(dirPath));
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isDirectory(node)) {···
return vow.fulfill(node.items.map(function (subNode) {
return getNodeName(subNode);
}));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsFileError(dirPath));
}
if (isDirectory(node)) {
Function (anonymous_688)
✗ Was not called
return vow.fulfill(node.items.map(function (subNode) {···
return getNodeName(subNode);
}));
return vow.fulfill(node.items.map(function (subNode) {
return getNodeName(subNode);
}));
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
return vow.reject(createFileNotFoundError(dirPath));
}
},
Function (anonymous_689)
✗ Was not called
makeDir: function (dirPath) {···
var node = getNode(dirPath);
if (node) {
if (isFile(node)) {
return vow.reject(createIsFileError(dirPath));
} else {
return vow.fulfill();
}
} else {
var parentDirPath = path.basename(dirPath);
return this.makeDir(parentDirPath).then(function () {
var parentNode = getNode(parentDirPath);
var childNode = getNode(dirPath);
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
});
}
},
makeDir: function (dirPath) {
var node = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
return vow.reject(createIsFileError(dirPath));
} else {
return vow.fulfill();
}
} else {
✗ Negative was not executed (else)
} else {···
var parentDirPath = path.basename(dirPath);
return this.makeDir(parentDirPath).then(function () {
var parentNode = getNode(parentDirPath);
var childNode = getNode(dirPath);
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
});
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
return vow.reject(createIsFileError(dirPath));
} else {
✗ Negative was not executed (else)
} else {···
return vow.fulfill();
}
if (isFile(node)) {
return vow.reject(createIsFileError(dirPath));
} else {
return vow.fulfill();
}
} else {
var parentDirPath = path.basename(dirPath);
Function (anonymous_690)
✗ Was not called
return this.makeDir(parentDirPath).then(function () {···
var parentNode = getNode(parentDirPath);
var childNode = getNode(dirPath);
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
});
return this.makeDir(parentDirPath).then(function () {
var parentNode = getNode(parentDirPath);
var childNode = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (childNode && parentNode.items.indexOf(childNode) !== -1) {···
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
✗ Negative was not executed (else)
} else {···
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
Branch LogicalExpression
✗ Was not returned
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
✗ Was not returned
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
if (childNode && parentNode.items.indexOf(childNode) !== -1) {
Branch IfStatement
✗ Positive was not executed (if)
if (isDirectory(childNode)) {···
return vow.fulfill();
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createIsFileError(dirPath));
}
if (isDirectory(childNode)) {
return vow.fulfill();
} else {
return vow.reject(createIsFileError(dirPath));
}
} else {
parentNode.items.push(createDirectoryNode(path.basename(dirPath)));
return vow.fulfill();
}
});
}
},
Function (anonymous_691)
✗ Was not called
isFile: function (filename) {···
var node = getNode(filename);
if (node) {
return vow.fulfill(isFile(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
isFile: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return vow.fulfill(isFile(node));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
return vow.fulfill(isFile(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_692)
✗ Was not called
isDir: function (filename) {···
var node = getNode(filename);
if (node) {
return vow.fulfill(isDirectory(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
isDir: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return vow.fulfill(isDirectory(node));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
return vow.fulfill(isDirectory(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_693)
✗ Was not called
isSocket: function (filename) {···
var node = getNode(filename);
if (node) {
return vow.fulfill(isSocket(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
isSocket: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return vow.fulfill(isSocket(node));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
return vow.fulfill(isSocket(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_694)
✗ Was not called
isSymLink: function (filename) {···
var node = getNode(filename);
if (node) {
return vow.fulfill(isSymLink(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
isSymLink: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return vow.fulfill(isSymLink(node));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
return vow.fulfill(isSymLink(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_695)
✗ Was not called
exists: function (filename) {···
return vow.fulfill(Boolean(getNode(filename)));
},
exists: function (filename) {
return vow.fulfill(Boolean(getNode(filename)));
},
Function (anonymous_696)
✗ Was not called
absolute: function (filename) {···
return vow.fulfill(path.resolve(root, filename));
},
absolute: function (filename) {
return vow.fulfill(path.resolve(root, filename));
},
Function (anonymous_697)
✗ Was not called
chown: function () {···
return vow.fulfill(); // не поддерживаем права
},
chown: function () {
return vow.fulfill(); // не поддерживаем права
},
Function (anonymous_698)
✗ Was not called
chmod: function () {···
return vow.fulfill(); // не поддерживаем права
},
chmod: function () {
return vow.fulfill(); // не поддерживаем права
},
Function (anonymous_699)
✗ Was not called
stats: function (filename) {···
var node = getNode(filename);
if (node) {
return vow.fulfill(createStats(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
stats: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return vow.fulfill(createStats(node));
} else {
✗ Negative was not executed (else)
} else {···
return vow.reject(createFileNotFoundError(filename));
}
if (node) {
return vow.fulfill(createStats(node));
} else {
return vow.reject(createFileNotFoundError(filename));
}
},
Function (anonymous_700)
✗ Was not called
link: function () {···
return vow.fulfill(); // не поддерживаем ссылки
},
link: function () {
return vow.fulfill(); // не поддерживаем ссылки
},
Function (anonymous_701)
✗ Was not called
symLink: function () {···
return vow.fulfill(); // не поддерживаем ссылки
}
symLink: function () {
return vow.fulfill(); // не поддерживаем ссылки
}
},
fs: {
Function (anonymous_702)
✗ Was not called
existsSync: function (filename) {···
return Boolean(getNode(filename));
},
existsSync: function (filename) {
return Boolean(getNode(filename));
},
Function (anonymous_703)
✗ Was not called
statSync: function (filename) {···
var node = getNode(filename);
if (node) {
return createStats(node);
} else {
throw createFileNotFoundError(filename);
}
},
statSync: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
return createStats(node);
} else {
✗ Negative was not executed (else)
} else {···
throw createFileNotFoundError(filename);
}
if (node) {
return createStats(node);
} else {
throw createFileNotFoundError(filename);
}
},
Function (anonymous_704)
✗ Was not called
readdir: function (dirPath, callback) {···
var node = getNode(dirPath);
if (!node) {
return callback(createFileNotFoundError(dirPath));
}
if (!isDirectory(node)) {
return callback(createIsFileError(dirPath));
}
callback(undefined, node.items.map(function (subNode) {
return getNodeName(subNode);
}));
},
readdir: function (dirPath, callback) {
var node = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (!node) {···
return callback(createFileNotFoundError(dirPath));
}
✗ Negative was not executed (else)
}···
if (!isDirectory(node)) {
if (!node) {
return callback(createFileNotFoundError(dirPath));
}
Branch IfStatement
✗ Positive was not executed (if)
if (!isDirectory(node)) {···
return callback(createIsFileError(dirPath));
}
✗ Negative was not executed (else)
}···
callback(undefined, node.items.map(function (subNode) {
if (!isDirectory(node)) {
return callback(createIsFileError(dirPath));
}
Function (anonymous_705)
✗ Was not called
callback(undefined, node.items.map(function (subNode) {···
return getNodeName(subNode);
}));
callback(undefined, node.items.map(function (subNode) {
return getNodeName(subNode);
}));
},
Function (anonymous_706)
✗ Was not called
readdirSync: function (dirPath) {···
var node = getNode(dirPath);
if (node) {
if (isDirectory(node)) {
return node.items.map(function (subNode) {
return getNodeName(subNode);
});
} else {
throw createIsFileError(dirPath);
}
} else {
throw createFileNotFoundError(dirPath);
}
},
readdirSync: function (dirPath) {
var node = getNode(dirPath);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isDirectory(node)) {
return node.items.map(function (subNode) {
return getNodeName(subNode);
});
} else {
throw createIsFileError(dirPath);
}
} else {
✗ Negative was not executed (else)
} else {···
throw createFileNotFoundError(dirPath);
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isDirectory(node)) {···
return node.items.map(function (subNode) {
return getNodeName(subNode);
});
} else {
✗ Negative was not executed (else)
} else {···
throw createIsFileError(dirPath);
}
if (isDirectory(node)) {
Function (anonymous_707)
✗ Was not called
return node.items.map(function (subNode) {···
return getNodeName(subNode);
});
return node.items.map(function (subNode) {
return getNodeName(subNode);
});
} else {
throw createIsFileError(dirPath);
}
} else {
throw createFileNotFoundError(dirPath);
}
},
Function (anonymous_708)
✗ Was not called
realpathSync: function (destPath) {···
return path.resolve(process.cwd(), destPath);
},
realpathSync: function (destPath) {
return path.resolve(process.cwd(), destPath);
},
Function (anonymous_709)
✗ Was not called
readFileSync: function (filename) {···
var node = getNode(filename);
if (node) {
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
}
readFileSync: function (filename) {
var node = getNode(filename);
Branch IfStatement
✗ Positive was not executed (if)
if (node) {···
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
✗ Negative was not executed (else)
} else {···
throw createFileNotFoundError(filename);
}
if (node) {
Branch IfStatement
✗ Positive was not executed (if)
if (isFile(node)) {···
return node.content;
} else {
✗ Negative was not executed (else)
} else {···
throw createIsDirectoryError(filename);
}
if (isFile(node)) {
return node.content;
} else {
throw createIsDirectoryError(filename);
}
} else {
throw createFileNotFoundError(filename);
}
}
}
};
}
test-logger.js
var inherit = require('inherit');
var TestLogger = inherit({
Function (anonymous_710)
✗ Was not called
__constructor: function (scope) {···
this._messages = [];
this._enabled = true;
this._scope = scope || '';
},
__constructor: function (scope) {
this._messages = [];
this._enabled = true;
Branch LogicalExpression
✗ Was not returned
this._scope = scope || '';
✗ Was not returned
this._scope = scope || '';
this._scope = scope || '';
},
Function (anonymous_711)
✗ Was not called
log: function (msg, scope, action) {···
if (this._enabled) {
this._messages.push({
message: msg,
scope: scope,
action: action
});
}
},
log: function (msg, scope, action) {
Branch IfStatement
✗ Positive was not executed (if)
if (this._enabled) {···
this._messages.push({
message: msg,
scope: scope,
action: action
});
}
✗ Negative was not executed (else)
}···
},
if (this._enabled) {
this._messages.push({
message: msg,
scope: scope,
action: action
});
}
},
Function (anonymous_712)
✗ Was not called
logAction: function (action, target, additionalInfo) {···
this.log(
additionalInfo,
(this._scope && (this._scope + '/')) + target,
action
);
},
logAction: function (action, target, additionalInfo) {
this.log(
additionalInfo,
Branch LogicalExpression
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
(this._scope && (this._scope + '/')) + target,
action
);
},
Function (anonymous_713)
✗ Was not called
logTechIsDeprecated: function (deprecatedTech, thisPackage, newTech, newPackage, desc) {···
this.logWarningAction('deprecated',
'Tech ' + thisPackage + '/techs/' + deprecatedTech + ' is deprecated.' +
(newTech && newPackage ?
' ' +
(newPackage === thisPackage ?
'Use ' :
'Install package ' + newPackage + ' and use '
) +
'tech ' + newPackage + '/techs/' + newTech + ' instead' :
''
) +
desc
);
},
logTechIsDeprecated: function (deprecatedTech, thisPackage, newTech, newPackage, desc) {
this.logWarningAction('deprecated',
'Tech ' + thisPackage + '/techs/' + deprecatedTech + ' is deprecated.' +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
' ' +···
(newPackage === thisPackage ?
'Use ' :
'Install package ' + newPackage + ' and use '
) +
'tech ' + newPackage + '/techs/' + newTech + ' instead' :
✗ Negative was not returned (: ...)
''
Branch LogicalExpression
✗ Was not returned
(newTech && newPackage ?
✗ Was not returned
(newTech && newPackage ?
(newTech && newPackage ?
' ' +
Branch ConditionalExpression
✗ Positive was not returned (? ...)
'Use ' :
✗ Negative was not returned (: ...)
'Install package ' + newPackage + ' and use '
(newPackage === thisPackage ?
'Use ' :
'Install package ' + newPackage + ' and use '
) +
'tech ' + newPackage + '/techs/' + newTech + ' instead' :
''
) +
desc
);
},
Function (anonymous_714)
✗ Was not called
logWarningAction: function (action, msg) {···
this.log(action, '', msg);
},
logWarningAction: function (action, msg) {
this.log(action, '', msg);
},
Function (anonymous_715)
✗ Was not called
logErrorAction: function (action, target, additionalInfo) {···
this.log(
additionalInfo,
(this._scope && (this._scope + '/')) + target,
action
);
},
logErrorAction: function (action, target, additionalInfo) {
this.log(
additionalInfo,
Branch LogicalExpression
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
✗ Was not returned
(this._scope && (this._scope + '/')) + target,
(this._scope && (this._scope + '/')) + target,
action
);
},
Function (anonymous_716)
✗ Was not called
isValid: function (target, tech) {···
this.logAction('isValid', target, tech);
},
isValid: function (target, tech) {
this.logAction('isValid', target, tech);
},
Function (anonymous_717)
✗ Was not called
logClean: function (target) {···
this.logAction('clean', target);
},
logClean: function (target) {
this.logAction('clean', target);
},
Function (anonymous_718)
✗ Was not called
setEnabled: function (enabled) {···
this._enabled = enabled;
},
setEnabled: function (enabled) {
this._enabled = enabled;
},
Function (anonymous_719)
✗ Was not called
isEnabled: function () {···
return this._enabled;
},
isEnabled: function () {
return this._enabled;
},
Function (anonymous_720)
✗ Was not called
subLogger: function (scope) {···
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
res.setEnabled(this._enabled);
return res;
}
subLogger: function (scope) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
✗ Negative was not returned (: ...)
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
Branch LogicalExpression
✗ Was not returned
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
✗ Was not returned
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
var res = new TestLogger(this._scope + (scope.charAt(0) === ':' ? scope : (this._scope && '/') + scope));
res.setEnabled(this._enabled);
return res;
}
});
module.exports = TestLogger;
test-node.js
var path = require('path');
var inherit = require('inherit');
var TestLogger = require('./test-logger');
var vow = require('vow');
var CacheStorage = require('../../cache/cache-storage');
var Cache = require('../../cache/cache');
var asyncFs = require('../../fs/async-fs');
var dropRequireCache = require('../../fs/drop-require-cache');
module.exports = inherit({
Function (anonymous_721)
✗ Was not called
__constructor: function (nodePath) {···
this._languages = [];
this._logger = new TestLogger(nodePath);
this._root = process.cwd();
this._path = nodePath;
this._dirname = this._root + '/' + nodePath;
this._targetName = path.basename(nodePath);
this._buildPromise = vow.promise();
this._buildPromises = [];
this._nodeCache = new Cache(new CacheStorage(), nodePath);
this._techData = {};
this._resultTechData = {};
this._nodeTechData = {};
this._levelNamingSchemes = {};
this.buildState = {};
},
__constructor: function (nodePath) {
this._languages = [];
this._logger = new TestLogger(nodePath);
this._root = process.cwd();
this._path = nodePath;
this._dirname = this._root + '/' + nodePath;
this._targetName = path.basename(nodePath);
this._buildPromise = vow.promise();
this._buildPromises = [];
this._nodeCache = new Cache(new CacheStorage(), nodePath);
this._techData = {};
this._resultTechData = {};
this._nodeTechData = {};
this._levelNamingSchemes = {};
this.buildState = {};
},
Function (anonymous_722)
✗ Was not called
getLanguages: function () {···
return this._languages;
},
getLanguages: function () {
return this._languages;
},
Function (anonymous_723)
✗ Was not called
setLanguages: function (languages) {···
this._languages = languages;
},
setLanguages: function (languages) {
this._languages = languages;
},
Function (anonymous_724)
✗ Was not called
getLogger: function () {···
return this._logger;
},
getLogger: function () {
return this._logger;
},
Function (anonymous_725)
✗ Was not called
setLogger: function (logger) {···
this._logger = logger;
},
setLogger: function (logger) {
this._logger = logger;
},
Function (anonymous_726)
✗ Was not called
getRootDir: function () {···
return this._root;
},
getRootDir: function () {
return this._root;
},
Function (anonymous_727)
✗ Was not called
getDir: function () {···
return this._dirname;
},
getDir: function () {
return this._dirname;
},
Function (anonymous_728)
✗ Was not called
getPath: function () {···
return this._path;
},
getPath: function () {
return this._path;
},
Function (anonymous_729)
✗ Was not called
getTechs: function () {···
throw new Error('Method `getTechs` is not implemented.');
},
getTechs: function () {
throw new Error('Method `getTechs` is not implemented.');
},
Function (anonymous_730)
✗ Was not called
setTechs: function () {···
throw new Error('Method `setTechs` is not implemented.');
},
setTechs: function () {
throw new Error('Method `setTechs` is not implemented.');
},
Function (anonymous_731)
✗ Was not called
setTargetsToBuild: function () {···
throw new Error('Method `setTargetsToBuild` is not implemented.');
},
setTargetsToBuild: function () {
throw new Error('Method `setTargetsToBuild` is not implemented.');
},
Function (anonymous_732)
✗ Was not called
setTargetsToClean: function () {···
throw new Error('Method `setTargetsToClean` is not implemented.');
},
setTargetsToClean: function () {
throw new Error('Method `setTargetsToClean` is not implemented.');
},
Function (anonymous_733)
✗ Was not called
setBuildGraph: function () {···
throw new Error('Method `setBuildGraph` is not implemented.');
},
setBuildGraph: function () {
throw new Error('Method `setBuildGraph` is not implemented.');
},
Function (anonymous_734)
✗ Was not called
resolvePath: function (filename) {···
return this._dirname + '/' + filename;
},
resolvePath: function (filename) {
return this._dirname + '/' + filename;
},
Function (anonymous_735)
✗ Was not called
resolveNodePath: function (nodePath, filename) {···
return this._root + '/' + nodePath + '/' + filename;
},
resolveNodePath: function (nodePath, filename) {
return this._root + '/' + nodePath + '/' + filename;
},
Function (anonymous_736)
✗ Was not called
unmaskNodeTargetName: function (nodePath, targetName) {···
return targetName.replace(/\?/g, path.basename(nodePath));
},
unmaskNodeTargetName: function (nodePath, targetName) {
return targetName.replace(/\?/g, path.basename(nodePath));
},
Function (anonymous_737)
✗ Was not called
relativePath: function (filename) {···
var res = path.relative(path.join(this._root, this._path), filename);
if (res.charAt(0) !== '.') {
res = './' + res;
}
return res;
},
relativePath: function (filename) {
var res = path.relative(path.join(this._root, this._path), filename);
Branch IfStatement
✗ Positive was not executed (if)
if (res.charAt(0) !== '.') {···
res = './' + res;
}
✗ Negative was not executed (else)
}···
return res;
if (res.charAt(0) !== '.') {
res = './' + res;
}
return res;
},
Function (anonymous_738)
✗ Was not called
unmaskTargetName: function (targetName) {···
return targetName.replace(/\?/g, this._targetName);
},
unmaskTargetName: function (targetName) {
return targetName.replace(/\?/g, this._targetName);
},
Function (anonymous_739)
✗ Was not called
getTargetName: function (suffix) {···
return this._targetName + (suffix ? '.' + suffix : '');
},
getTargetName: function (suffix) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return this._targetName + (suffix ? '.' + suffix : '');
✗ Negative was not returned (: ...)
return this._targetName + (suffix ? '.' + suffix : '');
return this._targetName + (suffix ? '.' + suffix : '');
},
Function (anonymous_740)
✗ Was not called
wwwRootPath: function (filename, wwwRoot) {···
wwwRoot = wwwRoot || '/';
return wwwRoot + path.relative(this._root, filename);
},
wwwRootPath: function (filename, wwwRoot) {
Branch LogicalExpression
✗ Was not returned
wwwRoot = wwwRoot || '/';
✗ Was not returned
wwwRoot = wwwRoot || '/';
wwwRoot = wwwRoot || '/';
return wwwRoot + path.relative(this._root, filename);
},
Function (anonymous_741)
✗ Was not called
cleanTargetFile: function () {···
throw new Error('Method `cleanTargetFile` is not implemented.');
},
cleanTargetFile: function () {
throw new Error('Method `cleanTargetFile` is not implemented.');
},
Function (anonymous_742)
✗ Was not called
createTmpFileForTarget: function () {···
throw new Error('Method `createTmpFileForTarget` is not implemented.');
},
createTmpFileForTarget: function () {
throw new Error('Method `createTmpFileForTarget` is not implemented.');
},
Function (anonymous_743)
✗ Was not called
loadTechs: function () {···
throw new Error('Method `loadTechs` is not implemented.');
},
loadTechs: function () {
throw new Error('Method `loadTechs` is not implemented.');
},
Function (anonymous_744)
✗ Was not called
hasRegisteredTarget: function () {···
throw new Error('Method `hasRegisteredTarget` is not implemented.');
},
hasRegisteredTarget: function () {
throw new Error('Method `hasRegisteredTarget` is not implemented.');
},
Function (anonymous_745)
✗ Was not called
resolveTarget: function (target, value) {···
this._resultTechData[target] = value;
this._buildPromise.fulfill(value);
this._buildPromises.push(vow.resolve(value));
},
resolveTarget: function (target, value) {
this._resultTechData[target] = value;
this._buildPromise.fulfill(value);
this._buildPromises.push(vow.resolve(value));
},
Function (anonymous_746)
✗ Was not called
isValidTarget: function (targetName) {···
this._logger.isValid(targetName);
},
isValidTarget: function (targetName) {
this._logger.isValid(targetName);
},
Function (anonymous_747)
✗ Was not called
rejectTarget: function (targetName, error) {···
this._buildPromise.reject(error);
},
rejectTarget: function (targetName, error) {
this._buildPromise.reject(error);
},
Function (anonymous_748)
✗ Was not called
requireNodeSources: function (sourcesByNodes) {···
var resultByNodes = {};

Object.keys(sourcesByNodes).forEach(function (nodePath) {
resultByNodes[nodePath] = sourcesByNodes[nodePath].map(function (target) {
var node = this._nodeTechData[nodePath];
return node && node[target];
}, this);
}, this);

return vow.fulfill(resultByNodes);
},
requireNodeSources: function (sourcesByNodes) {
var resultByNodes = {};
Function (anonymous_749)
✗ Was not called
Object.keys(sourcesByNodes).forEach(function (nodePath) {···
resultByNodes[nodePath] = sourcesByNodes[nodePath].map(function (target) {
var node = this._nodeTechData[nodePath];
return node && node[target];
}, this);
}, this);
Object.keys(sourcesByNodes).forEach(function (nodePath) {
Function (anonymous_750)
✗ Was not called
resultByNodes[nodePath] = sourcesByNodes[nodePath].map(function (target) {···
var node = this._nodeTechData[nodePath];
return node && node[target];
}, this);
resultByNodes[nodePath] = sourcesByNodes[nodePath].map(function (target) {
var node = this._nodeTechData[nodePath];
Branch LogicalExpression
✗ Was not returned
return node && node[target];
✗ Was not returned
return node && node[target];
return node && node[target];
}, this);
}, this);
return vow.fulfill(resultByNodes);
},
Function (anonymous_751)
✗ Was not called
requireSources: function (sources) {···
return vow.all(sources.map(function (source) {
return vow.fulfill(this._techData[source]);
}, this));
},
requireSources: function (sources) {
Function (anonymous_752)
✗ Was not called
return vow.all(sources.map(function (source) {···
return vow.fulfill(this._techData[source]);
}, this));
return vow.all(sources.map(function (source) {
return vow.fulfill(this._techData[source]);
}, this));
},
Function (anonymous_753)
✗ Was not called
cleanTargets: function () {···
throw new Error('Method `cleanTargets` is not implemented.');
},
cleanTargets: function () {
throw new Error('Method `cleanTargets` is not implemented.');
},
Function (anonymous_754)
✗ Was not called
build: function () {···
throw new Error('Method `build` is not implemented.');
},
build: function () {
throw new Error('Method `build` is not implemented.');
},
Function (anonymous_755)
✗ Was not called
clean: function () {···
throw new Error('Method `clean` is not implemented.');
},
clean: function () {
throw new Error('Method `clean` is not implemented.');
},
Function (anonymous_756)
✗ Was not called
getNodeCache: function (subCacheName) {···
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
},
getNodeCache: function (subCacheName) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
✗ Negative was not returned (: ...)
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
return subCacheName ? this._nodeCache.subCache(subCacheName) : this._nodeCache;
},
Function (anonymous_757)
✗ Was not called
getLevelNamingScheme: function (levelPath) {···
return this._levelNamingSchemes[levelPath];
},
getLevelNamingScheme: function (levelPath) {
return this._levelNamingSchemes[levelPath];
},
Function (anonymous_758)
✗ Was not called
destruct: function () {···
throw new Error('Method `destruct` is not implemented.');
},
destruct: function () {
throw new Error('Method `destruct` is not implemented.');
},
Function (anonymous_759)
✗ Was not called
provideTechData: function (targetName, value) {···
targetName = this.unmaskTargetName(targetName);
this._techData[targetName] = value;
},
provideTechData: function (targetName, value) {
targetName = this.unmaskTargetName(targetName);
this._techData[targetName] = value;
},
Function (anonymous_760)
✗ Was not called
provideNodeTechData: function (node, targetName, value) {···
targetName = this.unmaskTargetName(targetName);

if (!this._nodeTechData[node]) {
this._nodeTechData[node] = {};
}
this._nodeTechData[node][targetName] = value;
},
provideNodeTechData: function (node, targetName, value) {
targetName = this.unmaskTargetName(targetName);
Branch IfStatement
✗ Positive was not executed (if)
if (!this._nodeTechData[node]) {···
this._nodeTechData[node] = {};
}
✗ Negative was not executed (else)
}···
this._nodeTechData[node][targetName] = value;
if (!this._nodeTechData[node]) {
this._nodeTechData[node] = {};
}
this._nodeTechData[node][targetName] = value;
},
Function (anonymous_761)
✗ Was not called
provideLevelNamingScheme: function (level, schemeBuilder) {···
var levels = Array.isArray(level) ? level : [level];
var _this = this;
levels.forEach(function (levelPath) {
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
return this;
},
provideLevelNamingScheme: function (level, schemeBuilder) {
Branch ConditionalExpression
✗ Positive was not returned (? ...)
var levels = Array.isArray(level) ? level : [level];
✗ Negative was not returned (: ...)
var levels = Array.isArray(level) ? level : [level];
var levels = Array.isArray(level) ? level : [level];
var _this = this;
Function (anonymous_762)
✗ Was not called
levels.forEach(function (levelPath) {···
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
levels.forEach(function (levelPath) {
Branch IfStatement
✗ Positive was not executed (if)
if (levelPath.charAt(0) !== '/') {···
levelPath = _this.resolvePath(levelPath);
}
✗ Negative was not executed (else)
}···
_this._levelNamingSchemes[levelPath] = schemeBuilder;
if (levelPath.charAt(0) !== '/') {
levelPath = _this.resolvePath(levelPath);
}
_this._levelNamingSchemes[levelPath] = schemeBuilder;
});
return this;
},
Function (anonymous_763)
✗ Was not called
runTech: function (TechClass, options) {···
options = options || {};
var tech = new TechClass(options);
tech.init(this);
return vow.fulfill().then(function () {
return vow.when(tech.build()).then(function () {
return this._buildPromise;
}.bind(this));
}.bind(this));
},
runTech: function (TechClass, options) {
Branch LogicalExpression
✗ Was not returned
options = options || {};
✗ Was not returned
options = options || {};
options = options || {};
var tech = new TechClass(options);
tech.init(this);
Function (anonymous_764)
✗ Was not called
return vow.fulfill().then(function () {···
return vow.when(tech.build()).then(function () {
return this._buildPromise;
}.bind(this));
}.bind(this));
return vow.fulfill().then(function () {
Function (anonymous_765)
✗ Was not called
return vow.when(tech.build()).then(function () {···
return this._buildPromise;
}.bind(this));
return vow.when(tech.build()).then(function () {
return this._buildPromise;
}.bind(this));
}.bind(this));
},
Function (anonymous_766)
✗ Was not called
runTechAndGetResults: function (TechClass, options) {···
options = options || {};
var tech = new TechClass(options);
tech.init(this);
return vow.fulfill().then(function () {
return vow.when(tech.build()).then(function () {
return vow.all(this._buildPromises).then(function () {
var resultByTargets = {};
tech.getTargets().forEach(function (targetName) {
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
return resultByTargets;
}.bind(this));
}.bind(this));
}.bind(this));
},
runTechAndGetResults: function (TechClass, options) {
Branch LogicalExpression
✗ Was not returned
options = options || {};
✗ Was not returned
options = options || {};
options = options || {};
var tech = new TechClass(options);
tech.init(this);
Function (anonymous_767)
✗ Was not called
return vow.fulfill().then(function () {···
return vow.when(tech.build()).then(function () {
return vow.all(this._buildPromises).then(function () {
var resultByTargets = {};
tech.getTargets().forEach(function (targetName) {
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
return resultByTargets;
}.bind(this));
}.bind(this));
}.bind(this));
return vow.fulfill().then(function () {
Function (anonymous_768)
✗ Was not called
return vow.when(tech.build()).then(function () {···
return vow.all(this._buildPromises).then(function () {
var resultByTargets = {};
tech.getTargets().forEach(function (targetName) {
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
return resultByTargets;
}.bind(this));
}.bind(this));
return vow.when(tech.build()).then(function () {
Function (anonymous_769)
✗ Was not called
return vow.all(this._buildPromises).then(function () {···
var resultByTargets = {};
tech.getTargets().forEach(function (targetName) {
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
return resultByTargets;
}.bind(this));
return vow.all(this._buildPromises).then(function () {
var resultByTargets = {};
Function (anonymous_770)
✗ Was not called
tech.getTargets().forEach(function (targetName) {···
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
tech.getTargets().forEach(function (targetName) {
resultByTargets[targetName] = this._resultTechData[targetName];
}, this);
return resultByTargets;
}.bind(this));
}.bind(this));
}.bind(this));
},
Function (anonymous_771)
✗ Was not called
runTechAndGetContent: function (TechClass, options) {···
options = options || {};
var node = this;
var tech = new TechClass(options);
tech.init(this);
return vow.fulfill().then(function () {
return vow.when(tech.build()).then(function () {
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
return asyncFs.read(node.resolvePath(targetName));
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
},
runTechAndGetContent: function (TechClass, options) {
Branch LogicalExpression
✗ Was not returned
options = options || {};
✗ Was not returned
options = options || {};
options = options || {};
var node = this;
var tech = new TechClass(options);
tech.init(this);
Function (anonymous_772)
✗ Was not called
return vow.fulfill().then(function () {···
return vow.when(tech.build()).then(function () {
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
return asyncFs.read(node.resolvePath(targetName));
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
return vow.fulfill().then(function () {
Function (anonymous_773)
✗ Was not called
return vow.when(tech.build()).then(function () {···
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
return asyncFs.read(node.resolvePath(targetName));
}, this));
}.bind(this));
}.bind(this));
return vow.when(tech.build()).then(function () {
Function (anonymous_774)
✗ Was not called
return this._buildPromise.then(function () {···
return vow.all(tech.getTargets().map(function (targetName) {
return asyncFs.read(node.resolvePath(targetName));
}, this));
}.bind(this));
return this._buildPromise.then(function () {
Function (anonymous_775)
✗ Was not called
return vow.all(tech.getTargets().map(function (targetName) {···
return asyncFs.read(node.resolvePath(targetName));
}, this));
return vow.all(tech.getTargets().map(function (targetName) {
return asyncFs.read(node.resolvePath(targetName));
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
},
Function (anonymous_776)
✗ Was not called
runTechAndRequire: function (TechClass, options) {···
options = options || {};
var node = this;
var tech = new TechClass(options);
tech.init(this);
return vow.fulfill().then(function () {
return vow.when(tech.build()).then(function () {
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
}
runTechAndRequire: function (TechClass, options) {
Branch LogicalExpression
✗ Was not returned
options = options || {};
✗ Was not returned
options = options || {};
options = options || {};
var node = this;
var tech = new TechClass(options);
tech.init(this);
Function (anonymous_777)
✗ Was not called
return vow.fulfill().then(function () {···
return vow.when(tech.build()).then(function () {
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
return vow.fulfill().then(function () {
Function (anonymous_778)
✗ Was not called
return vow.when(tech.build()).then(function () {···
return this._buildPromise.then(function () {
return vow.all(tech.getTargets().map(function (targetName) {
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
}.bind(this));
}.bind(this));
return vow.when(tech.build()).then(function () {
Function (anonymous_779)
✗ Was not called
return this._buildPromise.then(function () {···
return vow.all(tech.getTargets().map(function (targetName) {
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
}.bind(this));
return this._buildPromise.then(function () {
Function (anonymous_780)
✗ Was not called
return vow.all(tech.getTargets().map(function (targetName) {···
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
return vow.all(tech.getTargets().map(function (targetName) {
var filename = node.resolvePath(targetName);
dropRequireCache(require, filename);
return require(filename);
}, this));
}.bind(this));
}.bind(this));
}.bind(this));
}
});